import { Path, Shape, ShapeGeometry, ShapeUtils, Vector2, Vector3 } from "three";
import AModelFmulaUtils from "./AModelFmulaUtils";
import { polygon } from '@turf/helpers';
import difference from '@turf/difference';
import { AK } from "../const/ModelConst";
import MeshGeomLib from "./MeshGeomLib";

/**
 * @description 铝模板生成工具类
 * @argument TODO:开发过程中代码重复较多，有时间需要重构下，抽一些方法出来(以后有时间做)。
 * @author songmy
 */
export default class MoldUtils {

    static SqrtValue(a: number, b: number): number {
        return Math.sqrt(a ** 2 + b ** 2);
    }

    static getCapsulePath(one: Vector2, two: Vector2, r: number, istop: boolean = false): Path {
        let result: Path;

        let center = one.clone().add(two).multiplyScalar(0.5);

        let rad = Math.sin(Math.PI / 4);

        if (istop) {
            result = new Path()
                .moveTo(center.x, center.y)
                .absarc(one.x, one.y, r, Math.PI * 0.25, Math.PI * 1.25, false)
                .lineTo(two.x - rad * r, two.y - rad * r)
                .absarc(two.x, two.y, r, Math.PI * 1.25, Math.PI * 0.25, false)
                .lineTo(one.x + rad * r, one.y + rad * r);
        }
        else {
            result = new Path()
                .moveTo(center.x, center.y)
                .absarc(one.x, one.y, r, Math.PI * 1.75, Math.PI * 0.75, false)
                .lineTo(two.x - rad * r, two.y + rad * r)
                .absarc(two.x, two.y, r, Math.PI * 0.75, Math.PI * 1.75, false)
                .lineTo(one.x + rad * r, one.y - rad * r);
        }

        return result;
    }

    static checkPointPolygon(points: Vector2[], p: Vector2) {
        let count = 0;
        let p1 = points[0];
        for (var i = 1; i < points.length; i++) { //遍历整个点
            var p2 = points[i];
            if (p.y > Math.min(p1.y, p2.y) && p.y <= Math.max(p1.y, p2.y)) { //纵坐标在范围之内

                if (p.x <= Math.max(p1.x, p2.x)) { //横坐标小于最大值
                    if (p1.y != p2.y) {
                        var temp_x = (p.y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y) + p1.x;

                        if (p1.x == p2.x || p.x <= temp_x)
                            count++;
                    }
                }
            }
            p1 = p2;
        }

        if (count % 2) {
            return true;
        } else {
            return false;
        }
    }

    static getXieFenVI3(count: number, vertices: any[], indices: any[], facevec: any[], cosA: number, sinA: number,
        ll: number, rl: number, bt: number, gw: number, pw: number, ph: number, x: number, y: number, offset: number[]): number {

        let tz = 0;
        let bz = -ph;

        let topface = [
            new Vector3(tz / sinA + tz / sinA * cosA, -gw, tz),
            new Vector3(bz / sinA + bz / sinA * cosA, -gw - pw, -bz),
            new Vector3(rl, -gw - pw, -bz),
            new Vector3(rl + offset[3], -gw, tz),

            new Vector3(tz / sinA + tz / sinA * cosA, -gw, tz)
        ]

        let bottomface = [
            new Vector3(tz / sinA + tz / sinA * cosA, -gw - x, tz - y),
            new Vector3(bz / sinA + bz / sinA * cosA, -gw - pw - x, -bz - y),
            new Vector3(rl + offset[5], -gw - pw - x, -bz - y),
            new Vector3(rl + offset[4], -gw - x, tz - y),

            new Vector3(tz / sinA + tz / sinA * cosA, -gw - x, tz - y)
        ]

        let side = MoldUtils.getVIF(bottomface, topface, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        topface = [
            new Vector3(tz / sinA + tz / sinA * cosA, -gw, tz),
            new Vector3(bz / sinA + bz / sinA * cosA, -gw - pw, -bz),
            new Vector3(ll * cosA - ph * sinA, -gw - pw, -ll * sinA - ph * cosA),
            new Vector3((ll + offset[0]) * cosA - 0 * sinA, -gw, -(ll + offset[0]) * sinA - 0 * cosA),
            new Vector3(tz / sinA + tz / sinA * cosA, -gw, tz)
        ]

        bottomface = [
            new Vector3(tz / sinA + tz / sinA * cosA + y * sinA, -gw - x, tz + y * cosA),
            new Vector3(bz / sinA + bz / sinA * cosA + y * sinA, -gw - pw - x, -bz + y * cosA),
            new Vector3((ll + offset[2]) * cosA - ph * sinA + y * sinA, -gw - pw - x, -(ll + offset[2]) * sinA - ph * cosA + y * cosA),
            new Vector3((ll + offset[1]) * cosA - 0 * sinA + y * sinA, -gw - x, -(ll + offset[1]) * sinA - 0 * cosA + y * cosA),
            new Vector3(tz / sinA + tz / sinA * cosA + y * sinA, -gw - x, tz + y * cosA)
        ]

        side = MoldUtils.getVIF(topface, bottomface, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        return count;
    }


    static getXieFenVI2(count: number, vertices: any[], indices: any[], facevec: any[], cosA: number, sinA: number,
        ll: number, rl: number, w: number, gw: number, pw: number, ph: number, bt: number, tz: number, bz: number): number {
        // 斜面
        let xy = MoldUtils.getXY(ph, pw, bt);
        let x = xy[0];
        let y = xy[1];


        let topface = [
            new Vector3(tz / sinA + tz / sinA * cosA, ph, tz),
            new Vector3(bz / sinA + bz / sinA * cosA, 0, bz),
            new Vector3(rl, 0, bz),
            new Vector3(rl, ph, tz),
            new Vector3(tz / sinA + tz / sinA * cosA, ph, tz)
        ]

        let bottomface = [
            new Vector3(tz / sinA + tz / sinA * cosA, ph - x, tz - y),
            new Vector3(bz / sinA + bz / sinA * cosA, 0 - x, bz - y),
            new Vector3(rl, 0 - x, bz - y),
            new Vector3(rl, ph - x, tz - y),
            new Vector3(tz / sinA + tz / sinA * cosA, ph - x, tz - y)
        ]

        let side = MoldUtils.getVIF(bottomface, topface, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        topface = [
            new Vector3(tz / sinA + tz / sinA * cosA, ph, tz),
            new Vector3(tz * sinA + ll * cosA, ph, ll * sinA - tz * cosA),
            new Vector3(bz * sinA + ll * cosA, 0, ll * sinA - bz * cosA),
            new Vector3(bz / sinA + bz / sinA * cosA, 0, bz),
            new Vector3(tz / sinA + tz / sinA * cosA, ph, tz)
        ]

        bottomface = [
            new Vector3(tz / sinA + tz / sinA * cosA - y * sinA, ph - x, tz + y * cosA),
            new Vector3(tz * sinA + ll * cosA - y * sinA, ph - x, ll * sinA - tz * cosA + y * cosA),
            new Vector3(bz * sinA + ll * cosA - y * sinA, 0 - x, ll * sinA - bz * cosA + y * cosA),
            new Vector3(bz / sinA + bz / sinA * cosA - y * sinA, 0 - x, bz + y * cosA),
            new Vector3(tz / sinA + tz / sinA * cosA - y * sinA, ph - x, tz + y * cosA)
        ]

        side = MoldUtils.getVIF(bottomface, topface, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        return count;
    }

    static getXieFenVI(count: number, vertices: any[], indices: any[], facevec: any[],
        ll: number, rl: number, h: number, bt: number, cosA: number, sinA: number, bevelw: number, bevelh: number) {

        // 斜面
        let xy = MoldUtils.getXY(bevelw, bevelh, bt);
        let x = xy[0];
        let y = xy[1];

        let topface = [
            new Vector3(0, -h + bevelh, 0),
            new Vector3(bevelh / sinA + bevelh / sinA * cosA, -h, bevelh),
            new Vector3(rl, -h, bevelh),
            new Vector3(rl, -h + bevelh, 0),
            new Vector3(0, -h + bevelh, 0)
        ]

        let bottomface = [
            new Vector3(0, -h + bevelh + x, 0 + y),
            new Vector3(bevelh / sinA + bevelh / sinA * cosA, -h + x, bevelh + y),
            new Vector3(rl, -h + x, bevelh + y),
            new Vector3(rl, -h + bevelh + x, 0 + y),
            new Vector3(0, -h + bevelh + x, 0 + y)
        ]

        let side = MoldUtils.getVIF(topface, bottomface, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        topface = [
            new Vector3(0, -h + bevelh, 0),
            new Vector3(ll * cosA, -h + bevelh, ll * sinA),
            new Vector3(bevelw * sinA + ll * cosA, -h, ll * sinA - bevelw * cosA),
            new Vector3(bevelh / sinA * cosA + bevelh / sinA, -h, bevelh),
            new Vector3(0, -h + bevelh, 0)
        ]

        bottomface = [
            new Vector3(0 + y * sinA, -h + bevelh + x, 0 - y * cosA),
            new Vector3(ll * cosA + y * sinA, -h + bevelh + x, ll * sinA - y * cosA),
            new Vector3(bevelw * sinA + ll * cosA + y * sinA, -h + x, ll * sinA - bevelw * cosA - y * cosA),
            new Vector3(bevelh / sinA * cosA + bevelh / sinA + y * sinA, -h + x, bevelh - y * cosA),
            new Vector3(0 + y * sinA, -h + bevelh + x, 0 - y * cosA)
        ]

        side = MoldUtils.getVIF(topface, bottomface, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        return count;
    }

    /**
    * 求厚度偏移x y
    * @param w 斜切宽
    * @param h 斜切高
    * @param t 厚度
    * @returns 
    */
    static getXY(w: number, h: number, t: number): number[] {
        let gl = MoldUtils.SqrtValue(w, h);
        let cosA = h / gl;
        let sinA = w / gl;

        let x = t * cosA;
        let y = t * sinA;

        return [x, y];
    }

    static getHoleByDivisions(holes: Path[]): Path[] {
        let divisions = 6;
        let result: Path[] = [];
        for (let hole of holes) {
            result.push(new Path(hole.getPoints(divisions)))
        }
        return result;
    }

    /**
        * 获取圆柱体数据
        * @param count 
        * @param vertices 
        * @param indices 
        * @param facevec 
        * @param x 长向定位
        * @param y 宽向偏移
        * @param zr 直径
        * @param miny 
        * @param maxy 
        * @returns 
        */
    static getCylinderVI(count: number, vertices: any[], indices: any[], facevec: any[],
        x: number, y: number, zr: number, miny: number, maxy: number, ir: number = 2, needTop: boolean = false): number {

        // 段数
        let i: number, pot: Vector2, ver: Vector2[];
        let segment: number = 6;

        // 外圈
        let shape = new Shape()
            .moveTo(0, 0)
            .absarc(0, 0, zr / 2, 0, Math.PI * 2, true);

        let shapePoints = shape.extractPoints(segment);

        ver = shapePoints.shape;
        let reverse = !ShapeUtils.isClockWise(ver);
        if (reverse) {
            ver = ver.reverse();
        }

        let topVec: Vector3[] = [];
        let bottomVec: Vector3[] = [];
        for (i = 0; i < ver.length; i++) {
            pot = ver[i];
            topVec.push(new Vector3(pot.x + x, maxy, pot.y + y));
            bottomVec.push(new Vector3(pot.x + x, miny, pot.y + y));
        }

        let side = MoldUtils.getSideVIF(bottomVec, topVec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 内圈
        shape = new Shape()
            .moveTo(0, 0)
            .absarc(0, 0, zr / 2 - ir, 0, Math.PI * 2, true);
        shapePoints = shape.extractPoints(segment);
        ver = shapePoints.shape;
        reverse = !ShapeUtils.isClockWise(ver);

        if (reverse) {
            ver = ver.reverse();
        }

        let itopVec: Vector3[] = [];
        let ibottomVec: Vector3[] = [];
        for (i = 0; i < ver.length; i++) {
            pot = ver[i];
            itopVec.push(new Vector3(pot.x + x, maxy, pot.y + y));
            ibottomVec.push(new Vector3(pot.x + x, miny, pot.y + y));
        }

        side = MoldUtils.getSideVIF(itopVec, ibottomVec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 底面
        side = MoldUtils.getSideVIF(ibottomVec, bottomVec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        if (needTop) {
            side = MoldUtils.getSideVIF(itopVec, topVec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];
        }


        return count;
    }
    /**
     * 根据类型修改数据
     * @param type 
     * @param ZYL 左翼长
     * @param xAxis 要修正的x值
     * @param cosA 余弦值
     * @param sinA 正弦值
     * @returns 
     */
    static getXZ(type: number, ZYL: number, xAxis: number, cosA: number, sinA: number) {
        let x = xAxis;
        let z = 0;
        if (type === 0) {

            x = xAxis * sinA + ZYL * cosA;
            z = -xAxis * cosA + ZYL * sinA;
        }
        else if (type === 1) {
            x = xAxis * cosA;
            z = xAxis * sinA;
        }
        else if (type === 2) {
            x = xAxis * sinA + ZYL * cosA;
            z = xAxis * cosA - ZYL * sinA;
        }
        return [x, z];
    }

    /**
     * 获取左侧斜封板的数据
     * @param count 
     * @param vertices 
     * @param indices 
     * @param facevec 
     * @param type 
     * @param ZYL 左翼长
     * @param BKH 封板厚度
     * @param cosA 夹角
     * @param sinA 夹角
     * @param topface 上坐标 封边
     * @param bottomface 下坐标 用于封边
     * @param path 路径
     * @param holes 洞
     * @param reverse 是否翻转索引
     * @returns 
     */
    static getFengVI(count: number, vertices: any[], indices: any[], facevec: any[],
        ZYL: number, BKH: number, cosA: number, sinA: number,
        topface: Vector3[], bottomface: Vector3[], path: Vector2[], holes: Path[], type: number = 0, reverse: boolean = false) {

        let topvec = topface.concat(topface[0].clone());
        let bottomvec = bottomface.concat(bottomface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 形状
        let shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let positionAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();

        // 顶点
        let vertex: any[] = []
        let index: any[] = [];

        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            let xz = MoldUtils.getXZ(type, ZYL, a, cosA, sinA);

            vertex.push(xz[0], b, xz[1]);

        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);


        }

        reverse ? index.reverse() : null;
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface.concat());

        count = Math.max(...indices) + 1;

        vertex = [];
        index = [];
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            let xz = MoldUtils.getXZ(type, ZYL - BKH, a, cosA, sinA);
            vertex.push(xz[0], b, xz[1]);

        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        reverse ? null : index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface.concat());

        count = Math.max(...indices) + 1;

        return count;
    }

    /**
     * 获取顶底侧边数据
     * @param bottomVec 
     * @param topVec 
     * @param vertexCount 
     * @returns 
     */
    static getVIF(bottomVec: Vector3[], topVec: Vector3[], vertexCount: number = 0): any[] {

        let face: Vector3[];

        let faceVec: any[] = [];
        let vertex: any[] = [];
        let index: any[] = [];

        // 侧面
        for (let i = 0; i < bottomVec.length - 1; i++) {
            // 顶点
            vertex.push(topVec[i].x, topVec[i].y, topVec[i].z);
            vertex.push(topVec[i + 1].x, topVec[i + 1].y, topVec[i + 1].z);

            vertex.push(bottomVec[i].x, bottomVec[i].y, bottomVec[i].z);
            vertex.push(bottomVec[i + 1].x, bottomVec[i + 1].y, bottomVec[i + 1].z);
            // 索引
            index.push(vertexCount + i, vertexCount + i + 2, vertexCount + i + 1);
            index.push(vertexCount + i + 2, vertexCount + i + 3, vertexCount + i + 1);
            // 面
            face = [];
            face.push(topVec[i], topVec[i + 1], bottomVec[i + 1], bottomVec[i]);
            faceVec.push(face);

            vertexCount += 3;
        }
        // 底面
        vertexCount += 4;

        vertex.push(bottomVec[0].x, bottomVec[0].y, bottomVec[0].z);
        vertex.push(bottomVec[1].x, bottomVec[1].y, bottomVec[1].z);
        vertex.push(bottomVec[3].x, bottomVec[3].y, bottomVec[3].z);
        vertex.push(bottomVec[2].x, bottomVec[2].y, bottomVec[2].z);

        index.push(vertexCount, vertexCount + 2, vertexCount + 1);
        index.push(vertexCount + 2, vertexCount + 3, vertexCount + 1);

        face = [];
        face.push(bottomVec[0], bottomVec[1], bottomVec[2], bottomVec[3]);
        faceVec.push(face);

        vertexCount += 4;
        vertex.push(topVec[0].x, topVec[0].y, topVec[0].z);
        vertex.push(topVec[1].x, topVec[1].y, topVec[1].z);
        vertex.push(topVec[3].x, topVec[3].y, topVec[3].z);
        vertex.push(topVec[2].x, topVec[2].y, topVec[2].z);

        index.push(vertexCount, vertexCount + 1, vertexCount + 2);
        index.push(vertexCount + 2, vertexCount + 1, vertexCount + 3);

        face = [];
        face.push(topVec[0], topVec[1], topVec[2], topVec[3]);
        faceVec.push(face);

        vertexCount += 4;

        return [vertex, index, faceVec, vertexCount];

    }
    /**
   * 获取矩形体
   * @param count 
   * @param vertices 
   * @param indices 
   * @param facevec 
   * @param minx 
   * @param maxx 
   * @param miny 
   * @param maxy 
   * @param minz 
   * @param maxz 
   * @returns 
   */
    static getCuboidVI(count: number, vertices: any[], indices: any[], facevec: any[],
        minx: number, maxx: number, miny: number, maxy: number, minz: number, maxz: number): number {

        let topface = [
            new Vector3(minx, miny, minz),
            new Vector3(minx, miny, maxz),
            new Vector3(maxx, miny, maxz),
            new Vector3(maxx, miny, minz),
            new Vector3(minx, miny, minz)
        ]

        let bottomface = [
            new Vector3(minx, maxy, minz),
            new Vector3(minx, maxy, maxz),
            new Vector3(maxx, maxy, maxz),
            new Vector3(maxx, maxy, minz),
            new Vector3(minx, maxy, minz)
        ]

        let vi = MoldUtils.getVIF(topface, bottomface, count);

        vertices.push(...vi[0]);
        indices.push(...vi[1]);
        facevec.push(...vi[2]);
        count = vi[3];

        return count;
    }

    /**
     * 获取侧边数据
     * @param bottomVec 底面数组 
     * @param topVec 顶部数组
     * @param vertexCount 索引值
     * @returns 
     */
    static getSideVIF(bottomVec: Vector3[], topVec: Vector3[], vertexCount: number): any[] {
        let face: Vector3[];

        let faceVec: any[] = [];
        let vertex: any[] = [];
        let index: any[] = [];

        // 侧面
        for (let i = 0; i < bottomVec.length - 1; i++) {
            // 顶点
            vertex.push(topVec[i].x, topVec[i].y, topVec[i].z);
            vertex.push(topVec[i + 1].x, topVec[i + 1].y, topVec[i + 1].z);

            vertex.push(bottomVec[i].x, bottomVec[i].y, bottomVec[i].z);
            vertex.push(bottomVec[i + 1].x, bottomVec[i + 1].y, bottomVec[i + 1].z);
            // 索引
            index.push(vertexCount + i, vertexCount + i + 2, vertexCount + i + 1);
            index.push(vertexCount + i + 2, vertexCount + i + 3, vertexCount + i + 1);
            // 面
            face = [];
            face.push(topVec[i], topVec[i + 1], bottomVec[i + 1], bottomVec[i]);
            faceVec.push(face);

            vertexCount += 3;
        };

        vertexCount += bottomVec.length - 1;

        return [vertex, index, faceVec, vertexCount];
    }


    /**
   * 改写顶点和索引
   * @param count 
   * @param vertices 
   * @param indices 
   * @param facevec 
   * @param face 
   * @param posAry 
   * @param idxAry 
   * @param max 
   * @param type 类型 1 x 2 y 0 z
   * @param reverse 
   * @returns 
   */
    static getShapeFaceVI(count: number, vertices: any[], indices: any[], facevec: any[], face: any[],
        posAry: any, idxAry: any, max: number, type: number = 0, reverse: boolean = false): number {
        // 顶点
        let vertex: any[] = []
        let index: any[] = [];

        for (let i = 0; i < posAry.array.length; i += 3) {

            let a = posAry.array[i];
            let b = posAry.array[i + 1];
            let c = posAry.array[i + 2];
            type === 1 ? vertex.push(max, a, b) :
                type === 2 ? vertex.push(a, max, b) :
                    vertex.push(a, b, max);
        }

        // 索引
        for (let i = 0; i < idxAry.array.length; i += 3) {
            let a = idxAry.array[i] + count;
            let b = idxAry.array[i + 1] + count;
            let c = idxAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        reverse ? index.reverse() : null;
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(face);

        count = Math.max(...indices) + 1;

        return count;
    }

    static getXieShapeFaceVI(count: number, vertices: any[], indices: any[], facevec: any[], face: any[],
        sinA: number, cosA: number, xie: number, posAry: any, idxAry: any, max: number, type: number = 0, reverse: boolean = false): number {
        // 顶点
        let vertex: any[] = []
        let index: any[] = [];

        let adv = xie === 0 ? -cosA : cosA
        for (let i = 0; i < posAry.array.length; i += 3) {

            let a = posAry.array[i];
            let b = posAry.array[i + 1];
            let c = posAry.array[i + 2];
            type === 1 ? vertex.push(max + b * adv, a, b * sinA) :
                type === 2 ? vertex.push(a, max + a * cosA, b) :
                    vertex.push(a * sinA, b, max + a * adv);
        }

        // 索引
        for (let i = 0; i < idxAry.array.length; i += 3) {
            let a = idxAry.array[i] + count;
            let b = idxAry.array[i + 1] + count;
            let c = idxAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        reverse ? index.reverse() : null;
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(face);

        count = Math.max(...indices) + 1;

        return count;
    }

    static haveData(data: Vector2[][]): boolean {
        for (let i = 0; i < data.length; i++) {
            if (data[i].length > 0) {
                return true;
            }
        }
        return false;
    }

    static getXieShapeVI(count: number, vertices: any[], indices: any[], facevec: any[], frontPath: Vector2[], backPath: Vector2[], holes: Path[],
        sinA: number, cosA: number, xie: number, type: number, min: number, max: number, reverse: boolean, sidereverse: boolean = false, createtop: boolean = true): number {

        let topface = [];
        let bottomface = [];
        let topvec = [];
        let bottomvec = [];

        let top: Vector3;
        let bottom: Vector3;
        let adv = xie === 0 ? - cosA : cosA; // 0 内斜 否则 外斜

        for (let i = 0; i < frontPath.length; i++) {

            top = type === 1 ? new Vector3(max + frontPath[i].y * adv, frontPath[i].x, frontPath[i].y * sinA) :
                type === 2 ? new Vector3(frontPath[i].x, max, frontPath[i].y) :
                    new Vector3(frontPath[i].x * sinA, frontPath[i].y, max + frontPath[i].x * adv);

            bottom = type === 1 ? new Vector3(min + backPath[i].y * adv, backPath[i].x, backPath[i].y * sinA) :
                type === 2 ? new Vector3(backPath[i].x, min, backPath[i].y) :
                    new Vector3(backPath[i].x * sinA, backPath[i].y, min + backPath[i].x * adv);

            topface.push(top);
            bottomface.push(bottom);
        }

        topvec = sidereverse ? bottomface.concat(bottomface[0].clone()) : topface.concat(topface[0].clone());
        bottomvec = sidereverse ? topface.concat(topface[0].clone()) : bottomface.concat(bottomface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 前后面
        let shape = new Shape().setFromPoints(frontPath);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let position = geometry.attributes.position;
        let index = geometry.getIndex();


        count = MoldUtils.getXieShapeFaceVI(count, vertices, indices, facevec, topface, sinA, cosA, xie, position, index, max, type, reverse);
        geometry.dispose();


        if (createtop) {

            // 前后面
            shape = new Shape().setFromPoints(backPath);
            // 挖孔
            if (holes && holes.length > 0) {
                shape.holes.push(...holes);
            }

            geometry = new ShapeGeometry(shape);
            position = geometry.attributes.position;
            index = geometry.getIndex();

            count = MoldUtils.getXieShapeFaceVI(count, vertices, indices, facevec, bottomface, sinA, cosA, xie, position, index, min, type, !reverse);
            geometry.dispose();
        }

        return count;
    }

    static getXieQieShapeVI(count: number, vertices: any[], indices: any[], facevec: any[], path: Vector2[], holes: Path[], topface: Vector3[], bottomface: Vector3[],
        type: number, min: number, max: number, reverse: boolean, createtop: boolean = true): number {
        // 前后面
        let shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let position = geometry.attributes.position;
        let index = geometry.getIndex();


        count = MoldUtils.getShapeFaceVI(count, vertices, indices, facevec, topface, position, index, max, type, reverse);
        if (createtop) {
            count = MoldUtils.getShapeFaceVI(count, vertices, indices, facevec, bottomface, position, index, min, type, !reverse);
        }
        geometry.dispose();


        return count;
    }

    /**
     * 获取形状组成的物体，可带孔
     * @param count 索引
     * @param vertices 顶点数组
     * @param indices 索引数组
     * @param facevec 面数组
     * @param path 形状路径
     * @param holes 洞路径
     * @param type 类型 0 z 1 x 2 y
     * @param min 最小值
     * @param max 最大值
     * @param reverse 是否颠倒索引
     * @param sidereverse 是否颠倒边
     * @returns 
     */
    static getShapeVI(count: number, vertices: any[], indices: any[], facevec: any[], path: Vector2[], holes: Path[],
        type: number, min: number, max: number, reverse: boolean, sidereverse: boolean = false, createtop: boolean = true): number {

        let topface = [];
        let bottomface = [];
        let topvec = [];
        let bottomvec = [];

        let top: Vector3;
        let bottom: Vector3;
        for (let i = 0; i < path.length; i++) {

            top = type === 1 ? new Vector3(max, path[i].x, path[i].y) :
                type === 2 ? new Vector3(path[i].x, max, path[i].y) :
                    new Vector3(path[i].x, path[i].y, max);

            bottom = type === 1 ? new Vector3(min, path[i].x, path[i].y) :
                type === 2 ? new Vector3(path[i].x, min, path[i].y) :
                    new Vector3(path[i].x, path[i].y, min);

            topface.push(top);
            bottomface.push(bottom);
        }

        topvec = sidereverse ? bottomface.concat(bottomface[0].clone()) : topface.concat(topface[0].clone());
        bottomvec = sidereverse ? topface.concat(topface[0].clone()) : bottomface.concat(bottomface[0].clone());

        // 侧边

        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        count = MoldUtils.getXieQieShapeVI(count, vertices, indices, facevec, path, holes, topface, bottomface, type, min, max, reverse, createtop);

        return count;
    }

  /**
   * 获取光面孔
   * @param r 
   * @param rpos 
   * @param holes 
   * @param type 0 x 1 y 2 z
   */
  static getGmtHoles(r: string, rpos: string, holes: Path[],
    type: number = 0, yfu: boolean = false, cvx: number = 0, cvy: number = 0,
    centres: Vector3[] = null, xfu: boolean = false): void {

    if (!r || r === "" || !rpos || rpos === "") return;

    let holePath: Path;
    let cdr: string[];
    let index: number = -1;
    let i: number, xv: number, yv: number, widthR: number, hightR: number, gmtR: number;
    let gmtpos = AModelFmulaUtils.getHolesbyExpress(rpos, 0, 3);

    if (gmtpos && gmtpos.length > 0) {
        for (i = 0; i < gmtpos.length; i++) {

            xv = type === 1 ? gmtpos[i].y : gmtpos[i].x;
            yv = type === 1 ? gmtpos[i].x : gmtpos[i].y;
            yv = yfu ? -yv : yv;
            xv = xfu ? -xv : xv;

            xv += cvx;
            yv += cvy;

            index = r.toString().indexOf('*');
            if (index != -1) {
                cdr = r.split('*');
                if (type === 1) {
                    widthR = Number(cdr[0]);
                    hightR = Number(cdr[1]);
                }
                else {
                    widthR = Number(cdr[1]);
                    hightR = Number(cdr[0]);
                }


                gmtR = widthR > hightR ? hightR : widthR;

                holePath = new Path();
                if (widthR > hightR) {
                    holePath.moveTo(xv, yv)
                        .absarc(xv + (widthR - hightR) / 2, yv, gmtR / 2, Math.PI * 1.5, Math.PI * 0.5, false)
                        .lineTo(xv - (widthR - hightR) / 2, yv + hightR / 2)
                        .absarc(xv - (widthR - hightR) / 2, yv, gmtR / 2, Math.PI * 0.5, Math.PI * 1.5, false)
                        .lineTo(xv + (widthR - hightR) / 2, yv - hightR / 2)
                }
                else {
                    holePath.moveTo(xv, yv)
                        .absarc(xv, yv + (hightR - widthR) / 2, gmtR / 2, 0, Math.PI, false)
                        .lineTo(xv - widthR / 2, yv - (hightR - widthR) / 2)
                        .absarc(xv, yv - (hightR - widthR) / 2, gmtR / 2, Math.PI, Math.PI * 2, false)
                        .lineTo(xv + widthR / 2, yv + (hightR - widthR) / 2)
                }
            }
            else {
                gmtR = Number(r);

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, gmtR / 2, 0, Math.PI * 2, true);
            }
            if (centres) centres.push(new Vector3(xv, yv));
            holes.push(holePath);
        }
    }

}



    /**
     * 斜切类型获取点值
     * @param xtype 第一个类型 0 常规 1 内斜 2 外斜 3 无
     * @param ytype 第二个类型
     * @param xv 第一个值
     * @param yv 第二个值
     */
    static getBevelByType(xtype: number, ytype: number, xv: number, yv: number, tanA: number, isl: boolean = true, ist: boolean = true): number[] {

        let fx: number, fy: number, sx: number, sy: number;

        if (isl) {
            fx = xtype === 1 ? xv / tanA : xtype === 2 ? -xv / tanA : xtype === 3 ? 0 : 0;
            sx = xtype === 1 ? yv / tanA : xtype === 2 ? -yv / tanA : xtype === 3 ? 0 : 0;
        }
        else {
            fx = xtype === 1 ? -xv / tanA : xtype === 2 ? xv / tanA : xtype === 3 ? 0 : 0;
            sx = xtype === 1 ? -yv / tanA : xtype === 2 ? yv / tanA : xtype === 3 ? 0 : 0;
        }

        if (ist) {
            fy = ytype === 1 ? -xv / tanA : ytype === 2 ? xv / tanA : ytype === 3 ? 0 : 0;
            sy = ytype === 1 ? -yv / tanA : ytype === 2 ? yv / tanA : ytype === 3 ? 0 : 0;
        }
        else {
            fy = ytype === 1 ? xv / tanA : ytype === 2 ? -xv / tanA : ytype === 3 ? 0 : 0;
            sy = ytype === 1 ? yv / tanA : ytype === 2 ? -yv / tanA : ytype === 3 ? 0 : 0;
        }

        return [fx, fy, sx, sy];
    }


    /**
    * 修改斜边生成数据
    * @param type 
    * @param a 
    * @param b 
    * @param cosA 
    * @param sinA 
    * @param zybkh 
    * @param sxbkh 
    * @param l 
    * @param w 
    * @param zsv 
    * @param zxv 
    * @param ysv 
    * @param yxv 
    * @param ist 
    * @returns 
    */
    static getModifyVertex(type: number, a: number, b: number, cosA: number, sinA: number, zybkh: number, sxbkh: number,
        l: number, w: number, zsv: number[], zxv: number[], ysv: number[], yxv: number[], ist: boolean = true): number[] {

        let x: number, y: number, z: number;
        if (type === 0) {
            // 左
            if (ist) {
                x = zsv[0] < 0 ? -b * cosA : zsv[0] > 0 ? b * cosA : 0;
                y = a;
                z = zsv[0] === 0 ? b : b * sinA;
            }
            else {
                x = zsv[0] < 0 ? -b * cosA + zybkh : zsv[0] > 0 ? b * cosA + zybkh : zybkh;
                y = a;
                z = zsv[0] === 0 ? b : b * sinA;
            }
        }
        else if (type === 1) {
            // 右
            if (ist) {
                x = ysv[0] < 0 ? w - b * cosA : ysv[0] > 0 ? w + b * cosA : w;
                y = a;
                z = ysv[0] === 0 ? b : b * sinA;
            }
            else {
                x = ysv[0] < 0 ? w - b * cosA - zybkh : ysv[0] > 0 ? w + b * cosA - zybkh : w - zybkh;
                y = a;
                z = ysv[0] === 0 ? b : b * sinA;
            }
        }
        else if (type === 2) {
            // 上
            if (ist) {
                x = a;
                y = zsv[3] < 0 ? l - b * cosA : zsv[3] > 0 ? l + b * cosA : l;
                z = zsv[3] === 0 ? b : b * sinA;
            }
            else {
                x = a;
                y = zsv[3] < 0 ? l - b * cosA - sxbkh : zsv[3] > 0 ? l + b * cosA - sxbkh : l - sxbkh;
                z = zsv[3] === 0 ? b : b * sinA;
            }
        }
        else if (type === 3) {
            // 下
            if (ist) {
                x = a;
                y = zxv[3] < 0 ? - b * cosA : zxv[3] > 0 ? b * cosA : 0;
                z = zxv[3] === 0 ? b : b * sinA;
            }
            else {
                x = a;
                y = zxv[3] < 0 ? - b * cosA + sxbkh : zxv[3] > 0 ? b * cosA + sxbkh : sxbkh;
                z = zxv[3] === 0 ? b : b * sinA;
            }
        }
        else if (type === 4) {
            // 下
            if (ist) {
                x = a;
                y = zxv[3] < 0 ? - b * cosA : zxv[3] > 0 ? b * cosA : 0;
                z = zxv[3] === 0 ? b : b * sinA;
            }
            else {
                x = a;
                y = zxv[3] < 0 ? - b * cosA - sxbkh : zxv[3] > 0 ? b * cosA - sxbkh : -sxbkh;
                z = zxv[3] === 0 ? b : b * sinA;
            }
        }

        return [x, y, z];
    }

    /**
     * 获取侧边的面
     * @param count 
     * @param vertices 
     * @param indices 
     * @param facevec 
     * @param topface 
     * @param bottomface 
     * @param reverse 
     * @returns 
     */
    static getSideFace(count: number, vertices: any[], indices: any[], facevec: any[],
        topface: Vector3[], bottomface: Vector3[], reverse: boolean = false): number {

        let topVec = reverse ? bottomface.concat(bottomface[0].clone()) : topface.concat(topface[0].clone());
        let bottomVec = reverse ? topface.concat(topface[0].clone()) : bottomface.concat(bottomface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(topVec, bottomVec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        return count;
    }

    /**
     * 获取洞
     * @param pos 位置
     * @param r 直径
     * @param bkkjmdis 距离
     * @param holes 洞
     * @param isy 是否是Y值，会对调 bkkjmdis /pos
     * @param isFuP 位置取负
     * @param isFuD 距离取负
     */
    static getHolesPathByOne(pos: any[], r: number, bkkjmdis: number, holes: Path[], isy: boolean, isFuP: boolean = false, isFuD: boolean = false): void {
        let xv: number, yv: number;
        let holePath: Path;
        let p: number, d: number;
        if (pos && pos.length > 0) {
            for (let i = 0; i < pos.length; i++) {
                p = isFuP ? - pos[i] : pos[i]
                d = isFuD ? - bkkjmdis : bkkjmdis;
                xv = isy ? p : d;
                yv = isy ? d : p;

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, r / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
        }
    }

    /**
   * 获取边框内/外斜
   * @param count 索引数量
   * @param vertices 顶点
   * @param indices 索引
   * @param facevec 面
   * @param topface 上面
   * @param bottomface 下面
   * @param type 类型 0 左 1 右，2上， 3下
   * @param path 路径
   * @param holes 洞
   * @param zybkh 左右边框厚
   * @param sxbkh 上下边框厚
   * @param cosA 
   * @param sinA 
   * @param zsv 左上
   * @param zxv 左下
   * @param ysv 右上
   * @param yxv 右下
   * @param reverse 是否翻转索引
   * @returns 
   */
    static getBevelFrameVI(count: number, vertices: any[], indices: any[], facevec: any[], topface: Vector3[], bottomface: Vector3[],
        type: number, path: Vector2[], holes: Path[], zybkh: number, sxbkh: number, cosA: number, sinA: number, l: number, w: number,
        zsv: number[], zxv: number[], ysv: number[], yxv: number[], reverse: boolean = false, gentop: boolean = true): number {

        // 形状
        let shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }
        // 数据
        let geometry = new ShapeGeometry(shape);
        let positions = geometry.attributes.position;
        let indexs = geometry.getIndex();

        let vertex: any[];
        let index: any[];
        let xyz: number[];
        let a: number, b: number, c: number, i: number;

        if (gentop) {
            vertex = [];
            for (i = 0; i < positions.array.length; i += 3) {

                a = positions.array[i];
                b = positions.array[i + 1];

                xyz = MoldUtils.getModifyVertex(type, a, b, cosA, sinA, zybkh, sxbkh, l, w, zsv, zxv, ysv, yxv, true);
                vertex.push(xyz[0], xyz[1], xyz[2]);
            }

            index = [];
            for (i = 0; i < indexs.array.length; i += 3) {
                a = indexs.array[i] + count;
                b = indexs.array[i + 1] + count;
                c = indexs.array[i + 2] + count;

                index.push(a, b, c);
            }
            if (!reverse) index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(topface.concat());

            count = Math.max(...indices) + 1;
        }

        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            xyz = MoldUtils.getModifyVertex(type, a, b, cosA, sinA, zybkh, sxbkh, l, w, zsv, zxv, ysv, yxv, false);
            vertex.push(xyz[0], xyz[1], xyz[2]);
        }

        // 索引
        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }
        if (reverse) index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface.concat());

        count = Math.max(...indices) + 1;

        return count;
    }

    static getPlateGapVI(data: ALParams, W: number, L: number, isWD: boolean) {

        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let DJXQH: number = Number(data.DJXQH);

        let gmt = isWD ? [
            [0, -DJXQH],
            [W, -DJXQH],
            [W, L],
            [0, L],
            [0, -DJXQH]
        ] : [
            [0, 0],
            [W, 0],
            [W, L],
            [0, L],
            [0, 0]
        ]

        let poly = polygon([gmt]);

        let i: number;
        // 缺口
        let result: any[] = gmt.concat();

        if (QKH > 0 && QKW > 0) {

            let diff: any;
            let dd: any;
            // 上
            let toppos: number = 0;
            let skqkdw = data.p_skqkdw;
            let skqkdwAry = skqkdw.split(',');
            if (skqkdwAry.length > 0 && skqkdwAry[0] !== "") {
                for (i = 0; i < skqkdwAry.length; i++) {
                    toppos += Number(skqkdwAry[i]);
                    if (toppos > 0) {
                        let toppathVec = [
                            [toppos - QKW / 2, L],
                            [toppos - QKW / 2, L - QKH],
                            [toppos + QKW / 2, L - QKH],
                            [toppos + QKW / 2, L],

                            [toppos - QKW / 2, L]
                        ]
                        let tpoly = polygon([toppathVec]);
                        diff = difference(poly, tpoly);
                        dd = diff.geometry.coordinates;
                        if (dd.length > 1) {
                            dd = dd[0][0].length > dd[1][0].length ? dd[0] : dd[1];
                        }
                        poly = polygon(dd);
                    }
                }
            }

            // 下
            let xiapos: number = 0;
            let xkqkdw = data.p_xkqkdw;
            let xkqkdwAry = xkqkdw.split(',');
            if (xkqkdwAry.length > 0 && xkqkdwAry[0] !== "") {
                for (i = 0; i < xkqkdwAry.length; i++) {
                    xiapos += Number(xkqkdwAry[i]);
                    if (xiapos > 0) {
                        let xiapathVec = [
                            [xiapos - QKW / 2, 0],
                            [xiapos - QKW / 2, QKH],
                            [xiapos + QKW / 2, QKH],
                            [xiapos + QKW / 2, 0],

                            [xiapos - QKW / 2, 0]
                        ]
                        let xpoly = polygon([xiapathVec]);
                        diff = difference(poly, xpoly);
                        dd = diff.geometry.coordinates;
                        if (dd.length > 1) {
                            dd = dd[0][0].length > dd[1][0].length ? dd[0] : dd[1];
                        }
                        poly = polygon(dd);
                    }
                }
            }

            // 左
            let zuopos: number = 0;
            let zkqkdw = data.p_zkqkdw;
            let zkqkdwAry = zkqkdw.split(',');
            if (zkqkdwAry.length > 0 && zkqkdwAry[0] !== "") {
                for (i = 0; i < zkqkdwAry.length; i++) {
                    zuopos += Number(zkqkdwAry[i]);
                    if (zuopos > 0) {
                        let zuopathVec = [
                            [0, zuopos + QKW / 2],
                            [0, zuopos - QKW / 2],
                            [QKH, zuopos - QKW / 2],
                            [QKH, zuopos + QKW / 2],

                            [0, zuopos + QKW / 2]
                        ]

                        let zpoly = polygon([zuopathVec]);
                        diff = difference(poly, zpoly);
                        dd = diff.geometry.coordinates;
                        if (dd.length > 1) {
                            dd = dd[0][0].length > dd[1][0].length ? dd[0] : dd[1];
                        }
                        poly = polygon(dd);
                    }
                }
            }

            // 右
            let youpos: number = 0;
            let ykqkdw = data.p_ykqkdw;
            let ykqkdwAry = ykqkdw.split(',');
            if (ykqkdwAry.length > 0 && ykqkdwAry[0] !== "") {
                for (i = 0; i < ykqkdwAry.length; i++) {
                    youpos += Number(ykqkdwAry[i]);
                    if (youpos > 0) {
                        let youpathVec = [
                            [W, youpos + QKW / 2],
                            [W, youpos - QKW / 2],
                            [W - QKH, youpos - QKW / 2],
                            [W - QKH, youpos + QKW / 2],

                            [W, youpos + QKW / 2]
                        ]
                        let ypoly = polygon([youpathVec]);
                        diff = difference(poly, ypoly);
                        dd = diff.geometry.coordinates;
                        if (dd.length > 1) {
                            dd = dd[0][0].length > dd[1][0].length ? dd[0] : dd[1];
                        }
                        poly = polygon(dd);
                    }
                }
            }

            // 右
            if (diff) {
                result = dd[0].concat();
            }
        }

        let pathVec: Vector2[] = [];
        for (let i = 0; i < result.length; i++) {
            pathVec.push(new Vector2(result[i][0], result[i][1]));
        }

        return pathVec;
    }

    static getBottomGapPath(data: ALParams, zxv: number[], yxv: number[]): any[] {

        let W: number = Number(data.W);

        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let sqrtv = MoldUtils.SqrtValue(data.XKH, zxv[3]);
        let path = [
            [0, 0],
            [zxv[2], sqrtv],
            [W + yxv[2], sqrtv],
            [W, 0],
            [0, 0]
        ]
        let poly = polygon([path]);
        let isone = false;
        // 缺口
        let result: any[] = [];
        let i: number, j: number;
        if (QKH > 0 && QKW > 0) {
            let diff: any;

            let bottomtpos: number = 0;
            let xkqkdw = data.p_xkqkdw;
            let xkqkdwAry = xkqkdw.split(',');
            if (xkqkdwAry.length > 0 && xkqkdwAry[0] !== "") {
                for (i = 0; i < xkqkdwAry.length; i++) {
                    bottomtpos += Number(xkqkdwAry[i]);
                    if (bottomtpos > 0) {
                        let toppathVec = [
                            [bottomtpos - QKW / 2, 0],
                            [bottomtpos - QKW / 2, sqrtv],
                            [bottomtpos + QKW / 2, sqrtv],
                            [bottomtpos + QKW / 2, 0],

                            [bottomtpos - QKW / 2, 0]
                        ]
                        let tpoly = polygon([toppathVec]);

                        diff = difference(poly, tpoly);
                        let dd = diff.geometry.coordinates;

                        if (dd && dd.length > 0) {
                            isone = dd.length === 1;
                            if (isone) {
                                // result = result.concat(dd);
                                poly = polygon(dd);
                            }
                            else {
                                result = result.concat(dd[0]);
                            }
                            if (dd.length > 1) poly = polygon(dd[1]);
                        }
                    }
                }
                result = result.concat(poly.geometry.coordinates);
            }
            // let toppos = Number(data.p_xkqkdw);
            // if (toppos > 0) {
            //     let toppathVec = [
            //         [toppos - QKW / 2, 0],
            //         [toppos - QKW / 2, sqrtv],
            //         [toppos + QKW / 2, sqrtv],
            //         [toppos + QKW / 2, 0],

            //         [toppos - QKW / 2, 0]
            //     ]
            //     let tpoly = polygon([toppathVec]);

            //     diff = difference(poly, tpoly);
            //     let dd = diff.geometry.coordinates;

            //     if (dd && dd.length > 0) {
            //         result = dd.concat();
            //     }
            // }
        }

        let target: any[] = [];
        let oneVec: Vector2[];
        for (i = 0; i < result.length; i++) {
            oneVec = [];
            for (j = 0; j < result[i].length; j++) {
                oneVec.push(new Vector2(result[i][j][0], result[i][j][1]));
            }
            target.push(oneVec);
        }

        return target;

        // if (result.length === 2) {
        //     let oneVec = []
        //     for (let i = 0; i < result[0][0].length; i++) {
        //         oneVec.push(new Vector2(result[0][0][i][0], result[0][0][i][1]));
        //     }
        //     let twoVec = []
        //     for (let i = 0; i < result[1][0].length; i++) {
        //         twoVec.push(new Vector2(result[1][0][i][0], result[1][0][i][1]));
        //     }

        //     return [oneVec, twoVec];
        // }
        // else {
        //     let pathVec: any[] = [];
        //     for (let i = 0; i < result[0].length; i++) {
        //         pathVec.push(new Vector2(result[0][i][0], result[0][i][1]));
        //     }

        //     return [pathVec];
        // }
    }

    static getRightGapPath(data: ALParams, ysv: number[], yxv: number[]): any[] {

        let W: number = Number(data.W);
        let L: number = Number(data.L);

        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let ysvsqrtv = MoldUtils.SqrtValue(data.YKH, ysv[0]);
        let yxvsqrtv = MoldUtils.SqrtValue(data.YKH, yxv[0]);
        let path = [
            [0, 0],
            [L, 0],
            [L + ysv[1], ysvsqrtv],
            [yxv[1], yxvsqrtv],
            [0, 0]
        ]
        let poly = polygon([path]);
        let isone = false;
        // 缺口
        let result: any[] = [];
        let i: number, j: number;
        if (QKH > 0 && QKW > 0) {
            let diff: any;

            let rightpos: number = 0;
            let ykqkdw = data.p_ykqkdw;
            let ykqkdwAry = ykqkdw.split(',');
            if (ykqkdwAry.length > 0 && ykqkdwAry[0] !== "") {
                for (i = 0; i < ykqkdwAry.length; i++) {
                    rightpos += Number(ykqkdwAry[i]);
                    if (rightpos > 0) {
                        let toppathVec = [
                            [rightpos - QKW / 2, 0],
                            [rightpos - QKW / 2, ysvsqrtv],
                            [rightpos + QKW / 2, yxvsqrtv],
                            [rightpos + QKW / 2, 0],

                            [rightpos - QKW / 2, 0]
                        ]
                        let tpoly = polygon([toppathVec]);

                        diff = difference(poly, tpoly);
                        let dd = diff.geometry.coordinates;
                        if (dd && dd.length > 0) {
                            isone = dd.length === 1;
                            if (isone) {
                                result = result.concat(dd);
                            }
                            else {
                                result = result.concat(dd[0]);
                            }
                            if (dd.length > 1) poly = polygon(dd[1]);
                        }
                    }
                }
                if (!isone) result = result.concat(poly.geometry.coordinates);
            }
        }

        let target: any[] = [];
        let oneVec: Vector2[];
        for (i = 0; i < result.length; i++) {
            oneVec = [];
            for (let j = 0; j < result[i].length; j++) {
                oneVec.push(new Vector2(result[i][j][0], result[i][j][1]));
            }
            target.push(oneVec);
        }

        return target;


        // if (result.length === 2) {
        //     let oneVec = []
        //     for (let i = 0; i < result[0][0].length; i++) {
        //         oneVec.push(new Vector2(result[0][0][i][0], result[0][0][i][1]));
        //     }
        //     let twoVec = []
        //     for (let i = 0; i < result[1][0].length; i++) {
        //         twoVec.push(new Vector2(result[1][0][i][0], result[1][0][i][1]));
        //     }

        //     return [oneVec, twoVec];
        // }
        // else {
        //     let pathVec: any[] = [];
        //     for (let i = 0; i < result[0].length; i++) {
        //         pathVec.push(new Vector2(result[0][i][0], result[0][i][1]));
        //     }

        //     return [pathVec];
        // }
    }

    static getLeftGapPath(data: ALParams, zsv: number[], zxv: number[]): any[] {

        let W: number = Number(data.W);
        let L: number = Number(data.L);

        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let zsvsqrt = MoldUtils.SqrtValue(data.ZKH, zsv[0]);
        let zxvsqrt = MoldUtils.SqrtValue(data.ZKH, zxv[0]);
        let path = [
            [0, 0],
            [L, 0],
            [L + zsv[1], zsvsqrt],
            [zxv[1], zxvsqrt],
            [0, 0]
        ]
        let poly = polygon([path]);

        let isone = false;
        // 缺口
        let result: any[] = [];
        let i: number, j: number;
        if (QKH > 0 && QKW > 0) {
            let diff: any;

            let leftpos: number = 0;
            let zkqkdw = data.p_zkqkdw;
            let zkqkdwAry = zkqkdw.split(',');
            if (zkqkdwAry.length > 0 && zkqkdwAry[0] !== "") {

                for (i = 0; i < zkqkdwAry.length; i++) {
                    leftpos += Number(zkqkdwAry[i]);
                    if (leftpos > 0) {
                        let toppathVec = [
                            [leftpos - QKW / 2, 0],
                            [leftpos - QKW / 2, zsvsqrt],
                            [leftpos + QKW / 2, zxvsqrt],
                            [leftpos + QKW / 2, 0],

                            [leftpos - QKW / 2, 0]
                        ]
                        let tpoly = polygon([toppathVec]);

                        diff = difference(poly, tpoly);
                        let dd = diff.geometry.coordinates;

                        if (dd && dd.length > 0) {
                            isone = dd.length === 1;
                            if (isone) {
                                result = result.concat(dd);
                            }
                            else {
                                result = result.concat(dd[0]);
                            }
                            // result = result.concat(dd[0]);
                            if (dd.length > 1) poly = polygon(dd[1]);
                        }
                    }
                }
                if (!isone) result = result.concat(poly.geometry.coordinates);
            }
        }


        let target: any[] = [];
        let oneVec: Vector2[];
        for (i = 0; i < result.length; i++) {
            oneVec = [];
            for (j = 0; j < result[i].length; j++) {
                oneVec.push(new Vector2(result[i][j][0], result[i][j][1]));
            }
            target.push(oneVec);
        }

        return target;

        // if (result.length === 2) {
        //     let oneVec = []
        //     for (let i = 0; i < result[0][0].length; i++) {
        //         oneVec.push(new Vector2(result[0][0][i][0], result[0][0][i][1]));
        //     }
        //     let twoVec = []
        //     for (let i = 0; i < result[1][0].length; i++) {
        //         twoVec.push(new Vector2(result[1][0][i][0], result[1][0][i][1]));
        //     }

        //     return [oneVec, twoVec];
        // }
        // else {
        //     let pathVec: any[] = [];
        //     for (let i = 0; i < result[0].length; i++) {
        //         pathVec.push(new Vector2(result[0][i][0], result[0][i][1]));
        //     }

        //     return [pathVec];
        // }
    }

    static getTopGapPath(data: ALParams, zsv: number[], ysv: number[]): any[] {

        let W: number = Number(data.W);
        let L: number = Number(data.L);

        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let zsvsqrt = MoldUtils.SqrtValue(data.SKH, zsv[3]);
        let ysvsqrt = MoldUtils.SqrtValue(data.SKH, ysv[3]);
        let path = [
            [0, 0],
            [zsv[2], zsvsqrt],
            [W + ysv[2], ysvsqrt],
            [W, 0],
            [0, 0]
        ]
        let poly = polygon([path]);

        let isone: boolean = false;
        // 缺口
        let result: any[] = [];
        let i: number, j: number;
        if (QKH > 0 && QKW > 0) {
            let diff: any;

            let toppos: number = 0;
            let skqkdw = data.p_skqkdw;
            let skqkdwAry = skqkdw.split(',');
            if (skqkdwAry.length > 0 && skqkdwAry[0] !== "") {

                for (i = 0; i < skqkdwAry.length; i++) {
                    toppos += Number(skqkdwAry[i]);
                    if (toppos > 0) {
                        let toppathVec = [
                            [toppos - QKW / 2, 0],
                            [toppos - QKW / 2, zsvsqrt],
                            [toppos + QKW / 2, ysvsqrt],
                            [toppos + QKW / 2, 0],

                            [toppos - QKW / 2, 0]
                        ]
                        let tpoly = polygon([toppathVec]);

                        diff = difference(poly, tpoly);
                        let dd = diff.geometry.coordinates;


                        if (dd && dd.length > 0) {
                            isone = dd.length === 1;
                            if (isone) {
                                poly = polygon(dd);
                            }
                            else {
                                result = result.concat(dd[0]);
                            }

                            if (dd.length > 1) poly = polygon(dd[1]);
                        }
                    }
                }
                result = result.concat(poly.geometry.coordinates);
            }

        }


        let target: any[] = [];
        let oneVec: Vector2[];
        for (i = 0; i < result.length; i++) {
            oneVec = [];
            for (j = 0; j < result[i].length; j++) {
                oneVec.push(new Vector2(result[i][j][0], result[i][j][1]));
            }
            target.push(oneVec);
        }

        return target;

        // if (result.length === 2) {
        //     let oneVec = []
        //     for (let i = 0; i < result[0][0].length; i++) {
        //         oneVec.push(new Vector2(result[0][0][i][0], result[0][0][i][1]));
        //     }
        //     let twoVec = []
        //     for (let i = 0; i < result[1][0].length; i++) {
        //         twoVec.push(new Vector2(result[1][0][i][0], result[1][0][i][1]));
        //     }

        //     return [oneVec, twoVec];
        // }
        // else {
        //     let pathVec: any[] = [];
        //     for (let i = 0; i < result[0].length; i++) {
        //         pathVec.push(new Vector2(result[0][i][0], result[0][i][1]));
        //     }

        //     return [pathVec];
        // }
    }

    static isPathZero(path: Vector2[]) {
        for (let i = 0; i < path.length; i++) {
            if (path[i].x < 0) {
                return true;
            }
        }

        return false;
    }


    static getRightGapFaceVI(count: number, vertices: any[], indices: any[], facevec: any[], W: number, one: Vector2[], holes: Path[], zkkpos: any[],
        ysv: number[], yxv: number[], cosA: number, sinA: number, YKH: number, ZYKH: number, BKKJMDis: number, BKDia: number, isPathMix: boolean = false) {
        let topface = isPathMix ? [
            new Vector3(W - ZYKH, one[1].x, 0),
            new Vector3(W - ZYKH, one[2].x, 0),
            new Vector3(W - ZYKH + ysv[0], one[3].x, YKH),
            new Vector3(W - ZYKH + yxv[0], one[0].x, YKH)
        ] : [
            new Vector3(W - ZYKH, one[0].x, 0),
            new Vector3(W - ZYKH, one[1].x, 0),
            new Vector3(W - ZYKH + ysv[0], one[2].x, YKH),
            new Vector3(W - ZYKH + yxv[0], one[3].x, YKH)
        ]

        let bottomface = isPathMix ? [
            new Vector3(W, one[1].x, 0),
            new Vector3(W, one[2].x, 0),
            new Vector3(W + ysv[0], one[3].x, YKH),
            new Vector3(W + yxv[0], one[0].x, YKH)
        ] : [
            new Vector3(W, one[0].x, 0),
            new Vector3(W, one[1].x, 0),
            new Vector3(W + ysv[0], one[2].x, YKH),
            new Vector3(W + yxv[0], one[3].x, YKH)
        ]

        holes = [];
        let i: number, xv: number, yv: number, holePath: Path;
        for (i = 0; i < zkkpos.length; i++) {
            xv = zkkpos[i];
            yv = YKH - BKKJMDis;

            if (isPathMix) {
                if (xv < one[1].x + BKDia / 2 || xv > one[2].x - BKDia / 2) {
                    continue;
                }
            }
            else {
                if (xv < one[0].x + BKDia / 2 || xv > one[1].x - BKDia / 2) {
                    continue;
                }
            }

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // 侧边
        count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, true);

        // 形状
        one.pop();
        let shape = new Shape().setFromPoints(one);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }
        // 数据
        let geometry = new ShapeGeometry(shape);
        let positions = geometry.attributes.position;
        let indexs = geometry.getIndex();

        let vertex: any[];
        let index: any[];

        let a: number, b: number, c: number, x: number, y: number, z: number;

        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = ysv[0] < 0 ? W - b * cosA - ZYKH : ysv[0] > 0 ? W + b * cosA - ZYKH : W - ZYKH;
            y = a;
            z = ysv[0] === 0 ? b : b * sinA;

            vertex.push(x, y, z);
        }

        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }
        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface.concat());

        count = Math.max(...indices) + 1;

        // 
        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = ysv[0] < 0 ? W - b * cosA : ysv[0] > 0 ? W + b * cosA : W;
            y = a;
            z = ysv[0] === 0 ? b : b * sinA;
            vertex.push(x, y, z);
        }

        // 索引
        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }

        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface.concat());

        count = Math.max(...indices) + 1;

        geometry.dispose();
        return count;
    }

    static getLeftGapFaceVI(count: number, vertices: any[], indices: any[], facevec: any[], L: number, one: Vector2[], holes: Path[], zkkpos: any[],
        zsv: number[], zxv: number[], cosA: number, sinA: number, ZKH: number, ZYKH: number, BKKJMDis: number, BKDia: number, isPathMix: boolean = false) {
        let topface = isPathMix ? [
            new Vector3(0, one[1].x, 0),
            new Vector3(0, one[2].x, 0),
            new Vector3(zsv[0], one[3].x, ZKH),
            new Vector3(zxv[0], one[0].x, ZKH)
        ] : [
            new Vector3(0, one[0].x, 0),
            new Vector3(0, one[1].x, 0),
            new Vector3(zsv[0], one[2].x, ZKH),
            new Vector3(zxv[0], one[3].x, ZKH)
        ]

        let bottomface = isPathMix ? [
            new Vector3(ZYKH, one[1].x, 0),
            new Vector3(ZYKH, one[2].x, 0),
            new Vector3(zsv[0] + ZYKH, one[3].x, ZKH),
            new Vector3(zxv[0] + ZYKH, one[0].x, ZKH)
        ] : [
            new Vector3(ZYKH, one[0].x, 0),
            new Vector3(ZYKH, one[1].x, 0),
            new Vector3(zsv[0] + ZYKH, one[2].x, ZKH),
            new Vector3(zxv[0] + ZYKH, one[3].x, ZKH)
        ]

        holes = [];
        let i: number, xv: number, yv: number, holePath: Path;
        for (i = 0; i < zkkpos.length; i++) {
            xv = zkkpos[i];
            yv = ZKH - BKKJMDis;

            if (isPathMix) {
                if (xv < one[1].x + BKDia / 2 || xv > one[2].x - BKDia / 2) {
                    continue;
                }
            }
            else {
                if (xv < one[0].x + BKDia / 2 || xv > one[1].x - BKDia / 2) {
                    continue;
                }
            }

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // 侧边
        count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, true);

        // 形状
        one.pop();
        let shape = new Shape().setFromPoints(one);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }
        // 数据
        let geometry = new ShapeGeometry(shape);
        let positions = geometry.attributes.position;
        let indexs = geometry.getIndex();

        let vertex: any[];
        let index: any[];

        let a: number, b: number, c: number, x: number, y: number, z: number;

        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = zsv[0] < 0 ? -b * cosA : zsv[0] > 0 ? b * cosA : 0;
            y = a;
            z = zsv[0] === 0 ? b : b * sinA;

            vertex.push(x, y, z);
        }

        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }
        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface.concat());

        count = Math.max(...indices) + 1;

        // 
        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = zsv[0] < 0 ? -b * cosA + ZYKH : zsv[0] > 0 ? b * cosA + ZYKH : ZYKH;
            y = a;
            z = zsv[0] === 0 ? b : b * sinA;

            vertex.push(x, y, z);
        }

        // 索引
        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }

        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface.concat());

        count = Math.max(...indices) + 1;

        geometry.dispose();
        return count;
    }


    static getTopGapFaceVI(count: number, vertices: any[], indices: any[], facevec: any[], L: number, one: Vector2[], holes: Path[], skkpos: any[],
        zsv: number[], ysv: number[], cosA: number, sinA: number, SKH: number, SXKH: number, BKKJMDis: number, BKDia: number, isPathMix: boolean = false) {
        let topface = isPathMix ? [
            new Vector3(one[1].x, L, 0),
            new Vector3(one[0].x, L + zsv[3], SKH),
            new Vector3(one[3].x, L + ysv[3], SKH),
            new Vector3(one[2].x, L, 0)
        ] : [
            new Vector3(one[0].x, L, 0),
            new Vector3(one[3].x, L + zsv[3], SKH),
            new Vector3(one[2].x, L + ysv[3], SKH),
            new Vector3(one[1].x, L, 0)
        ]

        let bottomface = isPathMix ? [
            new Vector3(one[1].x, L - SXKH, 0),
            new Vector3(one[0].x, L + zsv[3] - SXKH, SKH),
            new Vector3(one[3].x, L + ysv[3] - SXKH, SKH),
            new Vector3(one[2].x, L - SXKH, 0)
        ] : [
            new Vector3(one[0].x, L - SXKH, 0),
            new Vector3(one[3].x, L + zsv[3] - SXKH, SKH),
            new Vector3(one[2].x, L + ysv[3] - SXKH, SKH),
            new Vector3(one[1].x, L - SXKH, 0)
        ]

        holes = [];
        let i: number, xv: number, yv: number, holePath: Path;
        for (i = 0; i < skkpos.length; i++) {
            xv = skkpos[i];
            yv = SKH - BKKJMDis;

            if (isPathMix) {
                if (xv < one[1].x + BKDia / 2 || xv > one[2].x - BKDia / 2) {
                    continue;
                }
            }
            else {
                if (xv < one[0].x + BKDia / 2 || xv > one[1].x - BKDia / 2) {
                    continue;
                }
            }

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // 侧边
        count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, true);

        // 形状
        one.pop();
        let shape = new Shape().setFromPoints(one);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }
        // 数据
        let geometry = new ShapeGeometry(shape);
        let positions = geometry.attributes.position;
        let indexs = geometry.getIndex();

        let vertex: any[];
        let index: any[];

        let a: number, b: number, c: number, x: number, y: number, z: number;

        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = a;
            y = zsv[3] < 0 ? L - b * cosA : zsv[3] > 0 ? L + b * cosA : L;
            z = zsv[3] === 0 ? b : b * sinA;

            vertex.push(x, y, z);
        }

        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }
        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface.concat());

        count = Math.max(...indices) + 1;

        // 
        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = a;
            y = zsv[3] < 0 ? L - b * cosA - SXKH : zsv[3] > 0 ? L + b * cosA - SXKH : L - SXKH;
            z = zsv[3] === 0 ? b : b * sinA;

            vertex.push(x, y, z);
        }

        // 索引
        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }

        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface.concat());

        count = Math.max(...indices) + 1;

        geometry.dispose();
        return count;
    }


    static getBottomGapFaceVI(count: number, vertices: any[], indices: any[], facevec: any[], L: number, one: Vector2[], holes: Path[], xkkpos: any[],
        zxv: number[], yxv: number[], cosA: number, sinA: number, XKH: number, SXKH: number, BKKJMDis: number, BKDia: number, isPathMix: boolean = false) {
        let topface = isPathMix ? [
            new Vector3(one[1].x, 0, 0),
            new Vector3(one[0].x, 0 + zxv[3], XKH),
            new Vector3(one[3].x, 0 + yxv[3], XKH),
            new Vector3(one[2].x, 0, 0)
        ] : [
            new Vector3(one[0].x, 0, 0),
            new Vector3(one[3].x, 0 + zxv[3], XKH),
            new Vector3(one[2].x, 0 + yxv[3], XKH),
            new Vector3(one[1].x, 0, 0)
        ]

        let bottomface = isPathMix ? [
            new Vector3(one[1].x, SXKH, 0),
            new Vector3(one[0].x, zxv[3] + SXKH, XKH),
            new Vector3(one[3].x, yxv[3] + SXKH, XKH),
            new Vector3(one[2].x, SXKH, 0)
        ] : [
            new Vector3(one[0].x, SXKH, 0),
            new Vector3(one[3].x, zxv[3] + SXKH, XKH),
            new Vector3(one[2].x, yxv[3] + SXKH, XKH),
            new Vector3(one[1].x, SXKH, 0)
        ]

        holes = [];
        let i: number, xv: number, yv: number, holePath: Path;
        for (i = 0; i < xkkpos.length; i++) {
            xv = xkkpos[i];
            yv = XKH - BKKJMDis;

            if (isPathMix) {
                if (xv < one[1].x + BKDia / 2 || xv > one[2].x - BKDia / 2) {
                    continue;
                }
            }
            else {
                if (xv < one[0].x + BKDia / 2 || xv > one[1].x - BKDia / 2) {
                    continue;
                }
            }

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // 侧边
        count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, true);

        // 形状
        one.pop();
        let shape = new Shape().setFromPoints(one);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }
        // 数据
        let geometry = new ShapeGeometry(shape);
        let positions = geometry.attributes.position;
        let indexs = geometry.getIndex();

        let vertex: any[];
        let index: any[];

        let a: number, b: number, c: number, x: number, y: number, z: number;

        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = a;
            y = zxv[3] < 0 ? - b * cosA : zxv[3] > 0 ? b * cosA : 0;
            z = zxv[3] === 0 ? b : b * sinA;

            vertex.push(x, y, z);
        }

        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }
        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface.concat());

        count = Math.max(...indices) + 1;

        // 
        vertex = [];
        for (i = 0; i < positions.array.length; i += 3) {

            a = positions.array[i];
            b = positions.array[i + 1];

            x = a;
            y = zxv[3] < 0 ? - b * cosA + SXKH : zxv[3] > 0 ? b * cosA + SXKH : SXKH;
            z = zxv[3] === 0 ? b : b * sinA;

            vertex.push(x, y, z);
        }

        // 索引
        index = [];
        for (i = 0; i < indexs.array.length; i += 3) {
            a = indexs.array[i] + count;
            b = indexs.array[i + 1] + count;
            c = indexs.array[i + 2] + count;

            index.push(a, b, c);
        }

        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface.concat());

        count = Math.max(...indices) + 1;

        geometry.dispose();
        return count;
    }

    /**
     * 平板
     * @param data 
     * @returns 
     */
    static getPlateVI(data: ALParams) {

        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];

        // 计数
        let count: number = 0;

        // 三角函数
        let radian = data.XBNXJD / 180 * Math.PI;
        let cosA = Math.cos(radian);
        let sinA = Math.sin(radian);
        let tanA = Math.tan(radian);

        // 形状
        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        // 坐标
        let i: number, xv: number, yv: number;

        // 顶底
        let topface: Vector3[];
        let bottomface: Vector3[];

        let W: number = Number(data.W);
        let L: number = Number(data.L);

        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let isCWD: boolean = W <= 50; // 宽度是否小于等于50
        let isCLD: boolean = L <= 50;  // 长度是否小于等于50

        let isWD: boolean = W <= 50 && data.p_isdjl === 1; // 是否是宽度低于50
        let DJXQW: number = Number(data.DJXQW);
        let DJXQH: number = Number(data.DJXQH);

        // 光面
        path = MoldUtils.getPlateGapVI(data, W, L, isWD);
        path.pop();

        holes = [];
        let createHole: boolean = data.p_facehole != 0;
        if (createHole) {
            MoldUtils.getGmtHoles(data.p_r1, data.p_r1dw, holes);
            MoldUtils.getGmtHoles(data.p_r2, data.p_r2dw, holes);
            MoldUtils.getGmtHoles(data.p_r3, data.p_r3dw, holes);
        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.GMT, 0, true);

        // 边框 斜切影响

        // 算斜切点
        let zsv: number[] = MoldUtils.getBevelByType(data.p_zksctype, data.p_sksctype, data.ZKH, data.SKH, tanA, true, true);
        let zxv: number[] = MoldUtils.getBevelByType(data.p_zksctype, data.p_xksctype, data.ZKH, data.XKH, tanA, true, false);
        let ysv: number[] = MoldUtils.getBevelByType(data.p_yksctype, data.p_sksctype, data.YKH, data.SKH, tanA, false, true);
        let yxv: number[] = MoldUtils.getBevelByType(data.p_yksctype, data.p_xksctype, data.YKH, data.XKH, tanA, false, false);

        // 左
        if (data.p_zksctype != 3 && !isCLD) {
            let zkkpos = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
            // 上缺口
            // let leftpqk = Number(data.p_zkqkdw);
            // 缺口值
            let leftpathv = MoldUtils.getLeftGapPath(data, zsv, zxv);
            if (QKH > 0 && QKW > 0 && leftpathv.length > 0) {

                let isPathMix: boolean = false;

                for (let leftindex = 0; leftindex < leftpathv.length; leftindex++) {
                    let one = leftpathv[leftindex].concat();
                    isPathMix = MoldUtils.isPathZero(one);
                    count = MoldUtils.getLeftGapFaceVI(count, vertices, indices, facevec, L, one, holes, zkkpos, zsv, zxv, cosA, sinA, data.ZKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                }
                // if (leftpathv.length === 1) {
                //     // 一种是单个
                //     let one = leftpathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getLeftGapFaceVI(count, vertices, indices, facevec, L, one, holes, zkkpos, zsv, zxv, cosA, sinA, data.ZKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
                // else if (leftpathv.length === 2) {
                //     // 一种是切两个
                //     let one = leftpathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getLeftGapFaceVI(count, vertices, indices, facevec, L, one, holes, zkkpos, zsv, zxv, cosA, sinA, data.ZKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                //     let two = leftpathv[1].concat();
                //     isPathMix = MoldUtils.isPathZero(two);
                //     count = MoldUtils.getLeftGapFaceVI(count, vertices, indices, facevec, L, two, holes, zkkpos, zsv, zxv, cosA, sinA, data.ZKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
            }
            else {
                let zsvsqrt = MoldUtils.SqrtValue(data.ZKH, zsv[0]);
                let zxvsqrt = MoldUtils.SqrtValue(data.ZKH, zxv[0]);
                path = isWD ? [
                    new Vector2(-DJXQH, 0),
                    new Vector2(L, 0),
                    new Vector2(L + zsv[1], zsvsqrt),
                    new Vector2(0, zxvsqrt),
                    new Vector2(-DJXQH, data.ZKH - DJXQW)
                ] : [
                    new Vector2(0, 0),
                    new Vector2(L, 0),
                    new Vector2(L + zsv[1], zsvsqrt),
                    new Vector2(zxv[1], zxvsqrt)
                ]

                holes = [];


                for (i = 0; i < zkkpos.length; i++) {
                    xv = zkkpos[i];
                    yv = data.ZKH - data.BKKJMDis;

                    holePath = new Path();
                    holePath.moveTo(xv, yv)
                        .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                    holes.push(holePath);
                }

                topface = isWD ? [

                    new Vector3(0, -DJXQH, 0),
                    new Vector3(0, L, 0),
                    new Vector3(zsv[0], L + zsv[1], data.ZKH),
                    new Vector3(zxv[0], 0, data.ZKH),
                    new Vector3(zxv[0] * (data.ZKH - DJXQW) / data.ZKH, -DJXQH, data.ZKH - DJXQW)
                ] : [
                    new Vector3(0, 0, 0),
                    new Vector3(0, L, 0),
                    new Vector3(zsv[0], L + zsv[1], data.ZKH),
                    new Vector3(zxv[0], zxv[1], data.ZKH)
                ]

                bottomface = isWD ? [

                    new Vector3(data.ZYKH, -DJXQH, 0),
                    new Vector3(data.ZYKH, L, 0),
                    new Vector3(data.ZYKH + zsv[0], L + zsv[1], data.ZKH),
                    new Vector3(data.ZYKH + zxv[0], 0, data.ZKH),
                    new Vector3(data.ZYKH + zxv[0] * (data.ZKH - DJXQW) / data.ZKH, -DJXQH, data.ZKH - DJXQW)
                ] : [
                    new Vector3(data.ZYKH, 0, 0),
                    new Vector3(data.ZYKH, L, 0),
                    new Vector3(zsv[0] + data.ZYKH, L + zsv[1], data.ZKH),
                    new Vector3(zxv[0] + data.ZYKH, zxv[1], data.ZKH)
                ]

                // 侧边
                count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, false);

                // 孔板
                count = MoldUtils.getBevelFrameVI(count, vertices, indices, facevec, topface, bottomface,
                    0, path, holes, data.ZYKH, data.SXKH, cosA, sinA, L, W, zsv, zxv, ysv, yxv, false);
            }
        }

        // 右
        if (data.p_yksctype != 3 && !isCLD) {

            let ykkpos = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
            // 上缺口
            // let rightpqk = Number(data.p_ykqkdw);
            // 缺口值
            let rightpathv = MoldUtils.getRightGapPath(data, ysv, yxv);
            if (QKH > 0 && QKW > 0 && rightpathv.length > 0) {
                let isPathMix: boolean = false;

                for (let leftindex = 0; leftindex < rightpathv.length; leftindex++) {
                    let one = rightpathv[leftindex].concat();
                    isPathMix = MoldUtils.isPathZero(one);
                    count = MoldUtils.getRightGapFaceVI(count, vertices, indices, facevec, W, one, holes, ykkpos, ysv, yxv, cosA, sinA, data.YKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                }

                // if (rightpathv.length === 1) {
                //     // 一种是单个
                //     let one = rightpathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getRightGapFaceVI(count, vertices, indices, facevec, W, one, holes, ykkpos, ysv, yxv, cosA, sinA, data.YKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
                // else if (rightpathv.length === 2) {
                //     // 一种是切两个
                //     let one = rightpathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getRightGapFaceVI(count, vertices, indices, facevec, W, one, holes, ykkpos, ysv, yxv, cosA, sinA, data.YKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                //     let two = rightpathv[1].concat();
                //     isPathMix = MoldUtils.isPathZero(two);
                //     count = MoldUtils.getRightGapFaceVI(count, vertices, indices, facevec, W, two, holes, ykkpos, ysv, yxv, cosA, sinA, data.YKH, data.ZYKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
            }
            else {
                let ysvsqrt = MoldUtils.SqrtValue(data.YKH, ysv[0]);
                let yxvsqrt = MoldUtils.SqrtValue(data.YKH, yxv[0]);
                path = isWD ? [
                    new Vector2(-DJXQH, 0),
                    new Vector2(L, 0),
                    new Vector2(L + ysv[1], ysvsqrt),
                    new Vector2(zxv[1], yxvsqrt),
                    new Vector2(-DJXQH, data.YKH - DJXQW)
                ] : [
                    new Vector2(0, 0),
                    new Vector2(L, 0),
                    new Vector2(L + ysv[1], ysvsqrt),
                    new Vector2(yxv[1], yxvsqrt)
                ]

                holes = [];

                for (i = 0; i < ykkpos.length; i++) {
                    xv = ykkpos[i];
                    yv = data.YKH - data.BKKJMDis;

                    holePath = new Path();
                    holePath.moveTo(xv, yv)
                        .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                    holes.push(holePath);
                }

                topface = isWD ? [
                    new Vector3(W - data.ZYKH, -DJXQH, 0),
                    new Vector3(W - data.ZYKH, L, 0),
                    new Vector3(W - data.ZYKH + ysv[0], L + ysv[1], data.YKH),
                    new Vector3(W - data.ZYKH + yxv[0], 0, data.YKH),
                    new Vector3(W - data.ZYKH + yxv[0] * (data.YKH - DJXQW) / data.YKH, -DJXQH, data.YKH - DJXQW),
                ] : [
                    new Vector3(W - data.ZYKH, 0, 0),
                    new Vector3(W - data.ZYKH, L, 0),
                    new Vector3(W - data.ZYKH + ysv[0], L + ysv[1], data.YKH),
                    new Vector3(W - data.ZYKH + yxv[0], yxv[1], data.YKH)
                ]

                bottomface = isWD ? [
                    new Vector3(W, -DJXQH, 0),
                    new Vector3(W, L, 0),
                    new Vector3(W + ysv[0], L + ysv[1], data.YKH),
                    new Vector3(W + yxv[0], 0, data.YKH),
                    new Vector3(W + yxv[0] * (data.YKH - DJXQW) / data.YKH, -DJXQH, data.YKH - DJXQW)
                ] : [
                    new Vector3(W, 0, 0),
                    new Vector3(W, L, 0),
                    new Vector3(W + ysv[0], L + ysv[1], data.YKH),
                    new Vector3(W + yxv[0], yxv[1], data.YKH)
                ]
                // 侧边
                count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, false);

                count = MoldUtils.getBevelFrameVI(count, vertices, indices, facevec, topface, bottomface,
                    1, path, holes, data.ZYKH, data.SXKH, cosA, sinA, L, W, zsv, zxv, ysv, yxv, true);
            }
        }

        // 上
        if (data.p_sksctype != 3 && !isCWD) {
            // 孔位
            let skkpos = AModelFmulaUtils.getHolesbyExpress(data.p_skkw, W, 2, data, AK.p_skkw);
            // 上缺口

            // 缺口值
            let toppathv = MoldUtils.getTopGapPath(data, zsv, ysv);

            if (QKH > 0 && QKW > 0 && toppathv.length > 0) {

                let isPathMix: boolean = false;

                for (let leftindex = 0; leftindex < toppathv.length; leftindex++) {
                    let one = toppathv[leftindex].concat();
                    isPathMix = MoldUtils.isPathZero(one);
                    count = MoldUtils.getTopGapFaceVI(count, vertices, indices, facevec, L, one, holes, skkpos, zsv, ysv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                }

                // if (toppathv.length === 1) {
                //     // 一种是单个
                //     let one = toppathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getTopGapFaceVI(count, vertices, indices, facevec, L, one, holes, skkpos, zsv, ysv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
                // else if (toppathv.length === 2) {
                //     // 一种是切两个
                //     let one = toppathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getTopGapFaceVI(count, vertices, indices, facevec, L, one, holes, skkpos, zsv, ysv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                //     let two = toppathv[1].concat();
                //     isPathMix = MoldUtils.isPathZero(two);
                //     count = MoldUtils.getTopGapFaceVI(count, vertices, indices, facevec, L, two, holes, skkpos, zsv, ysv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
            }
            else {
                let skhzsv = MoldUtils.SqrtValue(data.SKH, zsv[3]);
                let skhysv = MoldUtils.SqrtValue(data.SKH, ysv[3]);
                path = [
                    new Vector2(0, 0),
                    new Vector2(zsv[2], skhzsv),
                    new Vector2(W + ysv[2], skhysv),
                    new Vector2(W, 0)
                ]

                holes = [];

                for (i = 0; i < skkpos.length; i++) {
                    xv = skkpos[i];
                    yv = data.SKH - data.BKKJMDis;

                    if (xv < path[0].x || xv > path[3].x) {
                        continue;
                    }

                    holePath = new Path();
                    holePath.moveTo(xv, yv)
                        .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                    holes.push(holePath);
                }

                topface = [
                    new Vector3(0, L, 0),
                    new Vector3(zsv[2], L + zsv[3], data.SKH),
                    new Vector3(W + ysv[2], L + ysv[3], data.SKH),
                    new Vector3(W, L, 0)
                ]

                bottomface = [
                    new Vector3(0, L - data.SXKH, 0),
                    new Vector3(zsv[2], L + zsv[3] - data.SXKH, data.SKH),
                    new Vector3(W + ysv[2], L + ysv[3] - data.SXKH, data.SKH),
                    new Vector3(W, L - data.SXKH, 0)
                ]
                count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, true);

                count = MoldUtils.getBevelFrameVI(count, vertices, indices, facevec, topface, bottomface,
                    2, path, holes, data.ZYKH, data.SXKH, cosA, sinA, L, W, zsv, zxv, ysv, yxv, false);
            }
        }

        if (data.p_xksctype != 3 && !isCWD) {

            let xkkpos = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
            // 下缺口

            // 缺口值
            let bottompathv = MoldUtils.getBottomGapPath(data, zxv, yxv);

            if (QKH > 0 && QKW > 0 && bottompathv.length > 0) {

                let isPathMix: boolean = false;

                for (let leftindex = 0; leftindex < bottompathv.length; leftindex++) {
                    let one = bottompathv[leftindex].concat();
                    isPathMix = MoldUtils.isPathZero(one);
                    count = MoldUtils.getBottomGapFaceVI(count, vertices, indices, facevec, L, one, holes, xkkpos, zxv, yxv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                }

                // if (bottompathv.length === 1) {
                //     // 一种是单个
                //     let one = bottompathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getBottomGapFaceVI(count, vertices, indices, facevec, L, one, holes, xkkpos, zxv, yxv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
                // else if (bottompathv.length === 2) {
                //     // 一种是切两个
                //     let one = bottompathv[0].concat();
                //     isPathMix = MoldUtils.isPathZero(one);
                //     count = MoldUtils.getBottomGapFaceVI(count, vertices, indices, facevec, L, one, holes, xkkpos, zxv, yxv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                //     let two = bottompathv[1].concat();
                //     isPathMix = MoldUtils.isPathZero(two);
                //     count = MoldUtils.getBottomGapFaceVI(count, vertices, indices, facevec, L, two, holes, xkkpos, zxv, yxv, cosA, sinA, data.SKH, data.SXKH, data.BKKJMDis, data.BKDia, isPathMix);
                // }
            }
            else {
                // 下

                let xkhzxv = MoldUtils.SqrtValue(data.XKH, zxv[3]);
                let xkhyxv = MoldUtils.SqrtValue(data.XKH, yxv[3]);
                path = [
                    new Vector2(0, 0),
                    new Vector2(zxv[2], xkhzxv),
                    new Vector2(W + yxv[2], xkhyxv),
                    new Vector2(W, 0)
                ]

                holes = [];

                for (i = 0; i < xkkpos.length; i++) {
                    xv = xkkpos[i];
                    yv = data.XKH - data.BKKJMDis;

                    holePath = new Path();
                    holePath.moveTo(xv, yv)
                        .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                    holes.push(holePath);
                }


                topface = [
                    new Vector3(0, 0, 0),
                    new Vector3(zxv[2], zxv[3], data.XKH),
                    new Vector3(W + yxv[2], yxv[3], data.XKH),
                    new Vector3(W, 0, 0)
                ]

                bottomface = [
                    new Vector3(0, data.SXKH, 0),
                    new Vector3(zxv[2], zxv[3] + data.SXKH, data.XKH),
                    new Vector3(W + yxv[2], yxv[3] + data.SXKH, data.XKH),
                    new Vector3(W, data.SXKH, 0)
                ]

                count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, false);

                count = MoldUtils.getBevelFrameVI(count, vertices, indices, facevec, topface, bottomface,
                    3, path, holes, data.ZYKH, data.SXKH, cosA, sinA, L, W, zsv, zxv, ysv, yxv, true);
            }
        }

        // 横肋
        let p: number;
        if (data.p_hldw && data.p_hldw != "" && !isCWD) {

            let hldw = AModelFmulaUtils.getHolesbyExpress(data.p_hldw, L, 2, data, AK.p_hldw);
            if (hldw && hldw.length > 0) {
                let hlw: number = Number(data.HLW);
                let hlh: number = Number(data.HLH);
                for (i = 0; i < hldw.length; i++) {
                    p = hldw[i];
                    count = MoldUtils.getCuboidVI(count, vertices, indices, facevec,
                        data.ZYKH, W - data.ZYKH, p - hlw / 2, p + hlw / 2, data.GMT, data.GMT + hlh);
                }
            }
        }

        // 竖肋
        if (!isCLD && data.p_sldw && data.p_sldw !== "") {

            let sldw = AModelFmulaUtils.getHolesbyExpress(data.p_sldw, W, 2, data, AK.p_sldw);

            for (i = 0; i < sldw.length; i++) {
                p = sldw[i];
                let slw: number = Number(data.SLW);
                let slh: number = Number(data.SLH);
                count = MoldUtils.getCuboidVI(count, vertices, indices, facevec,
                    p - slw / 2, p + slw / 2, data.SXKH, L - data.SXKH, data.GMT, data.GMT + slh);
            }
        }

        // 角铝
        if (data.p_isdjl === 1 && !isCWD) {
            // 背板
            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, W, -data.JLH, 0, 0, data.GMT);
            // 下
            let jlzxv = MoldUtils.SqrtValue(data.XKH, zxv[3]);
            let jlyxv = MoldUtils.SqrtValue(data.XKH, yxv[3]);
            path = [
                new Vector2(0, 0),
                new Vector2(zxv[2], jlzxv),
                new Vector2(W + yxv[2], jlyxv),
                new Vector2(W, 0)
            ]

            holes = [];
            let jvkpos = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
            for (i = 0; i < jvkpos.length; i++) {
                xv = jvkpos[i];
                yv = data.XKH - data.BKKJMDis;

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }


            topface = [
                new Vector3(0, 0, 0),
                new Vector3(zxv[2], zxv[3], data.XKH),
                new Vector3(W + yxv[2], yxv[3], data.XKH),
                new Vector3(W, 0, 0)
            ]

            bottomface = [
                new Vector3(0, -data.SXKH, 0),
                new Vector3(zxv[2], zxv[3] - data.SXKH, data.XKH),
                new Vector3(W + yxv[2], yxv[3] - data.SXKH, data.XKH),
                new Vector3(W, -data.SXKH, 0)
            ]

            count = MoldUtils.getSideFace(count, vertices, indices, facevec, topface, bottomface, true);
            if (data.p_xksctype != 3) {
                count = MoldUtils.getBevelFrameVI(count, vertices, indices, facevec, topface, bottomface,
                    4, path, holes, data.ZYKH, data.SXKH, cosA, sinA, L, W, zsv, zxv, ysv, yxv, false, false);
            }
            else {
                count = MoldUtils.getBevelFrameVI(count, vertices, indices, facevec, topface, bottomface,
                    4, path, holes, data.ZYKH, data.SXKH, cosA, sinA, L, W, zsv, zxv, ysv, yxv, false);
            }
        }

        return [vertices, indices, facevec];
    }

    /**
     * 获取普通c槽的内外斜切y值
     * @param tanA 
     * @param W 
     * @param H 
     * @param XQNXJL 
     * @param BKH 
     * @param zktype 
     * @param yktype 
     * @param type 
     * @returns 
     */
    static getIOXie(tanA: number, sinA: number, W: number, H: number, XQNXJL: number, BKH: number, GMT: number, BKT: number, zktype: number, yktype: number, type: number, top: boolean) {

        let one: number, two: number, three: number, four: number, five: number, six: number;
        let none: number, ntwo: number, nthree: number, nfour: number, nfive: number, nsix: number, nseven: number, neight: number;

        let gmtju = GMT / tanA;
        let xieju = BKH / tanA; //斜距
        let zbb = BKH / H;
        let ybb = BKH / W;

        let znbb = (H - xieju) / H;

        let zwbb = H / (H + xieju);

        let zbnn = (H - BKT / sinA - xieju) / H;
        let zbwn = H / (H - BKT / sinA + xieju);

        let ybnn = (W - BKT / sinA - xieju) / W;
        let ybwn = W / (W - BKT / sinA + xieju);

        let gmtn = (H - gmtju) / H;
        let gmtw = H / (H + gmtju);

        let wgmtn = (W - gmtju) / W;
        let wgmtw = W / (W + gmtju);

        let ynbb = (W - xieju) / W;
        let ywbb = W / (W + xieju);

        let zib = GMT / H;
        let zmb = (H - BKT) / H;

        let yib = GMT / W
        let ymb = (W - BKT) / W;

        if (type === 1) {
            // 左外
            one = 0;
            two = 0;
            three = XQNXJL * zbb;
            four = XQNXJL * zbb;

            five = yktype === 1 ? XQNXJL * znbb : yktype === 2 ? XQNXJL / zwbb : XQNXJL;
            six = XQNXJL;

            none = XQNXJL * zib;
            ntwo = XQNXJL * zib;

            nthree = 0;
            nfour = XQNXJL * zbb;

            nfive = yktype === 1 ? XQNXJL * zbnn : yktype === 2 ? XQNXJL / zbwn : XQNXJL * zmb;
            nsix = XQNXJL * zmb;

            nseven = 0;
            neight = yktype === 1 ? XQNXJL * gmtn : yktype === 2 ? XQNXJL / gmtw : XQNXJL;;
        }
        else if (type === 2) {
            // 左内
            one = 0;
            two = 0;
            three = -XQNXJL * zbb;
            four = -XQNXJL * zbb;

            five = yktype === 1 ? -XQNXJL * znbb : yktype === 2 ? -XQNXJL / zwbb : -XQNXJL;
            six = -XQNXJL;

            none = -XQNXJL * zib;
            ntwo = -XQNXJL * zib;
            nthree = 0;
            nfour = -XQNXJL * zbb;

            nfive = yktype === 1 ? -XQNXJL * zbnn : yktype === 2 ? - XQNXJL / zbwn : -XQNXJL * zmb;
            nsix = -XQNXJL * zmb;

            nseven = 0;
            neight = yktype === 1 ? -XQNXJL * gmtn : yktype === 2 ? -XQNXJL / gmtw : -XQNXJL;;
        }
        else if (type === 3) {
            // 右外
            one = 0;
            two = XQNXJL
            three = zktype === 1 ? XQNXJL * ynbb : zktype === 2 ? XQNXJL / ywbb : XQNXJL;
            four = XQNXJL * ybb;

            five = XQNXJL * ybb;
            six = 0;


            none = 0;
            ntwo = zktype === 1 ? XQNXJL * wgmtn : zktype === 2 ? XQNXJL / wgmtw : XQNXJL;

            nthree = XQNXJL * ymb;
            nfour = zktype === 1 ? XQNXJL * ybnn : zktype === 2 ? XQNXJL / ybwn : XQNXJL * ymb;

            nfive = XQNXJL * ybb;
            nsix = 0;

            nseven = XQNXJL * yib;
            neight = XQNXJL * yib;
        }
        else if (type === 4) {
            // 右内
            one = 0;
            two = -XQNXJL
            three = zktype === 1 ? -XQNXJL * ynbb : zktype === 2 ? -XQNXJL / ywbb : -XQNXJL;
            four = -XQNXJL * ybb;

            five = -XQNXJL * ybb;
            six = 0;

            none = 0;
            ntwo = zktype === 1 ? -XQNXJL * wgmtn : zktype === 2 ? -XQNXJL / wgmtw : -XQNXJL;

            nthree = -XQNXJL * ymb;
            nfour = zktype === 1 ? -XQNXJL * ybnn : zktype === 2 ? -XQNXJL / ybwn : - XQNXJL * ymb;

            nfive = -XQNXJL * ybb;
            nsix = 0;

            nseven = -XQNXJL * yib;
            neight = -XQNXJL * yib;
        }
        else {
            one = 0;
            two = 0;
            three = 0;
            four = 0;
            five = 0;
            six = 0;

            none = 0;
            ntwo = 0;
            nthree = 0;
            nfour = 0;

            nfive = 0;
            nsix = 0;
            nseven = 0;
            neight = 0;
        }
        return top ? [one, two, three, four, five, six, none, ntwo, nthree, nfour, nfive, nsix, nseven, neight] :
            [-one, -two, -three, -four, -five, -six, -none, -ntwo, -nthree, -nfour, -nfive, -nsix, -nseven, -neight];
    }


    static getFaceByPaths(count: number, vertices: any[], indices: any[], facevec: any[], frontPath: Vector2[], backPath: Vector2[], holes: Path[],
        type: number, min: number, max: number, reverse: boolean, sidereverse: boolean = false, createtop: boolean = true) {
        let topface = [];
        let bottomface = [];
        let topvec = [];
        let bottomvec = [];

        let top: Vector3;
        let bottom: Vector3;
        for (let i = 0; i < frontPath.length; i++) {

            top = type === 1 ? new Vector3(max, frontPath[i].x, frontPath[i].y) :
                type === 2 ? new Vector3(frontPath[i].x, max, frontPath[i].y) :
                    new Vector3(frontPath[i].x, frontPath[i].y, max);

            bottom = type === 1 ? new Vector3(min, backPath[i].x, backPath[i].y) :
                type === 2 ? new Vector3(backPath[i].x, min, backPath[i].y) :
                    new Vector3(backPath[i].x, backPath[i].y, min);

            topface.push(top);
            bottomface.push(bottom);
        }

        topvec = sidereverse ? bottomface.concat(bottomface[0].clone()) : topface.concat(topface[0].clone());
        bottomvec = sidereverse ? topface.concat(topface[0].clone()) : bottomface.concat(bottomface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 前后面
        let shape = new Shape().setFromPoints(frontPath);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let position = geometry.attributes.position;
        let index = geometry.getIndex();


        count = MoldUtils.getShapeFaceVI(count, vertices, indices, facevec, topface, position, index, max, type, reverse);
        geometry.dispose();

        shape = new Shape().setFromPoints(backPath);

        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        geometry = new ShapeGeometry(shape);
        position = geometry.attributes.position;
        index = geometry.getIndex();

        count = MoldUtils.getShapeFaceVI(count, vertices, indices, facevec, bottomface, position, index, min, type, !reverse);
        geometry.dispose();

        return count;
    }

    static getRightSlotGapPath(data: ALParams, xzioxie: number[], syioxie: number[], L: number, H: number, len: number): any[] {

        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let frontPath = [
            [0, 0 + xzioxie[12]],
            [H + len, 0 + xzioxie[13]],
            [H + len, L + syioxie[13]],
            [0, L + syioxie[12]],
            [0, 0 + xzioxie[12]],
        ];

        let backPath = [
            [0, 0 + xzioxie[0]],
            [H, 0 + xzioxie[5]],
            [H, L + syioxie[5]],
            [0, L + syioxie[0]],
            [0, 0 + xzioxie[0]],
        ];

        let fronpoly = polygon([frontPath]);
        let backpoly = polygon([backPath]);

        let i: number;
        let fd, bd;
        if (QKH > 0 && QKW > 0) {
            let backdiff: any;
            let frontdiff: any;

            let rightpos: number = 0;

            let ykqkdw = data.p_ykqkdw;
            let ykqkdwAry = ykqkdw.split(',');
            if (ykqkdwAry.length > 0 && ykqkdwAry[0] !== "") {
                for (i = 0; i < ykqkdwAry.length; i++) {
                    rightpos += Number(ykqkdwAry[i]);
                    if (rightpos > 0) {
                        let fpath = [
                            [H + len - QKH, rightpos - QKW / 2],
                            [H + len, rightpos - QKW / 2],
                            [H + len, rightpos + QKW / 2],
                            [H + len - QKH, rightpos + QKW / 2],
                            [H + len - QKH, rightpos - QKW / 2],
                        ]

                        let bpath = [
                            [H - QKH, rightpos - QKW / 2],
                            [H, rightpos - QKW / 2],
                            [H, rightpos + QKW / 2],
                            [H - QKH, rightpos + QKW / 2],
                            [H - QKH, rightpos - QKW / 2],
                        ]

                        let fpoly = polygon([fpath]);
                        let bpoly = polygon([bpath])

                        frontdiff = difference(fronpoly, fpoly);
                        backdiff = difference(backpoly, bpoly);

                        fd = frontdiff.geometry.coordinates;
                        bd = backdiff.geometry.coordinates;
                        if (fd.length > 1) {
                            fd = fd[0][0].length > fd[1][0].length ? fd[0] : fd[1];
                        }
                        if (bd.length > 1) {
                            bd = bd[0][0].length > bd[1][0].length ? bd[0] : bd[1];
                        }
                        fronpoly = polygon(fd);
                        backpoly = polygon(bd);
                    }
                }
            }

        }

        let frontpathVec: any[] = [];
        let backpathVec: any[] = [];
        if (fd && fd.length > 0) {
            for (let i = 0; i < fd[0].length; i++) {
                frontpathVec.push(new Vector2(fd[0][i][0], fd[0][i][1]));
            }
        }
        if (bd && bd.length > 0) {
            for (let i = 0; i < bd[0].length; i++) {
                backpathVec.push(new Vector2(bd[0][i][0], bd[0][i][1]));
            }
        }
        return [frontpathVec, backpathVec];
    }


    static getLeftSlotGapPath(data: ALParams, xzioxie: number[], syioxie: number[], L: number, W: number, len: number): any[] {

        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let frontPath = [
            [0 + xzioxie[0], 0],
            [L + syioxie[0], 0],
            [L + syioxie[1], W],
            [0 + xzioxie[1], W],
            [0 + xzioxie[0], 0],
        ];

        let backPath = [
            [0 + xzioxie[6], 0],
            [L + syioxie[6], 0],
            [L + syioxie[7], W + len],
            [0 + xzioxie[7], W + len],
            [0 + xzioxie[6], 0],
        ];

        let fronpoly = polygon([frontPath]);
        let backpoly = polygon([backPath]);

        let fd, bd;
        let i: number, j: number;
        if (QKH > 0 && QKW > 0) {
            let backdiff: any;
            let frontdiff: any;
            let leftpos: number = 0;
            let zkqkdw = data.p_zkqkdw;
            let zkqkdwAry = zkqkdw.split(',');
            if (zkqkdwAry.length > 0 && zkqkdwAry[0] !== "") {
                for (i = 0; i < zkqkdwAry.length; i++) {
                    leftpos += Number(zkqkdwAry[i]);
                    if (leftpos > 0) {
                        let leftpathf = [
                            [leftpos - QKW / 2, W],
                            [leftpos - QKW / 2, W - QKH],
                            [leftpos + QKW / 2, W - QKH],
                            [leftpos + QKW / 2, W],

                            [leftpos - QKW / 2, W]
                        ]

                        let leftpathb = [
                            [leftpos - QKW / 2, W + len],
                            [leftpos - QKW / 2, W + len - QKH],
                            [leftpos + QKW / 2, W + len - QKH],
                            [leftpos + QKW / 2, W + len],

                            [leftpos - QKW / 2, W + len]
                        ]

                        let fpoly = polygon([leftpathf]);
                        let bpoly = polygon([leftpathb])

                        frontdiff = difference(fronpoly, fpoly);
                        backdiff = difference(backpoly, bpoly);

                        fd = frontdiff.geometry.coordinates;
                        bd = backdiff.geometry.coordinates;

                        if (fd.length > 1) {
                            fd = fd[0][0].length > fd[1][0].length ? fd[0] : fd[1];
                        }
                        if (bd.length > 1) {
                            bd = bd[0][0].length > bd[1][0].length ? bd[0] : bd[1];
                        }
                        fronpoly = polygon(fd);
                        backpoly = polygon(bd);
                    }
                }
            }
        }

        let frontpathVec: any[] = [];
        let backpathVec: any[] = [];
        if (fd && fd.length > 0) {
            for (let i = 0; i < fd[0].length; i++) {
                frontpathVec.push(new Vector2(fd[0][i][0], fd[0][i][1]));
            }
        }
        if (bd && bd.length > 0) {
            for (let i = 0; i < bd[0].length; i++) {
                backpathVec.push(new Vector2(bd[0][i][0], bd[0][i][1]));
            }
        }
        return [frontpathVec, backpathVec];
    }

    static getNormalSlotLeftGapPath(iswall: boolean, data: ALParams, len: number,
        DJXQW: number, DJXQH: number, xzioxie: number[], syioxie: number[]) {
        let W: number = Number(data.W);
        let L: number = Number(data.L);
        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let frontPath: number[][], backPath: number[][];
        if (iswall) {
            frontPath = [
                [0, 0],
                [len - DJXQW, 0],
                [len, DJXQH],
                [len, L],
                [0, L],
                [0, 0]
            ]

            backPath = [
                [0, 0],
                [len - DJXQW, 0],
                [len, DJXQH],
                [len, L],
                [0, L],
                [0, 0]
            ]
        }
        else {
            frontPath = [
                [0, 0 + xzioxie[1]],
                [len, 0 + xzioxie[2]],
                [len, L + syioxie[2]],
                [0, L + syioxie[1]],
                [0, 0 + xzioxie[1]]
            ]

            backPath = [
                [0, 0 + xzioxie[8]],
                [len, 0 + xzioxie[9]],
                [len, L + syioxie[9]],
                [0, L + syioxie[8]],
                [0, 0 + xzioxie[8]]
            ]
        }
        let fisone = false;
        let bisone = false;
        let frontpoly = polygon([frontPath]);
        let backpoly = polygon([backPath]);

        let fpathVec: number[][], bpathVec: number[][];
        let fdiff: any, bdiff: any;
        let fresult: any[] = [];
        let bresult: any[] = [];
        let i: number, j: number;
        // 缺口
        if (QKH > 0 && QKW > 0) {

            let leftpos: number = 0;
            let zkqkdw = data.p_zkqkdw;
            let zkqkdwAry = zkqkdw.split(',');
            if (zkqkdwAry.length > 0 && zkqkdwAry[0] !== "") {

                for (i = 0; i < zkqkdwAry.length; i++) {
                    leftpos += Number(zkqkdwAry[i]);
                    if (leftpos > 0) {

                        let walltp = leftpos + QKW / 2;
                        let wallbp = leftpos - QKW / 2;

                        if (iswall) {

                            let walltlen: number;
                            if (walltp >= 0 && walltp < DJXQH) {
                                walltlen = walltp / DJXQH * DJXQW + len - DJXQW
                            }
                            else {
                                walltlen = len;
                            }

                            let wallblen: number;
                            if (wallbp >= 0 && wallbp < DJXQH) {
                                wallblen = wallbp / DJXQH * DJXQW + len - DJXQW
                            }
                            else {
                                wallblen = len;
                            }

                            fpathVec = [
                                [0, wallbp],
                                [wallblen, wallbp],
                                [walltlen, walltp],
                                [0, walltp],
                                [0, wallbp]
                            ]
                            bpathVec = [
                                [0, wallbp],
                                [wallblen, wallbp],
                                [walltlen, walltp],
                                [0, walltp],
                                [0, wallbp]
                            ]
                        }
                        else {
                            fpathVec = [
                                [0, wallbp],
                                [len, wallbp],
                                [len, walltp],
                                [0, walltp],
                                [0, wallbp]
                            ]

                            bpathVec = [
                                [0, wallbp],
                                [len, wallbp],
                                [len, walltp],
                                [0, walltp],
                                [0, wallbp]
                            ]
                        }

                        let tpoly = polygon([fpathVec]);
                        let bpoly = polygon([bpathVec]);

                        let fg = difference(frontpoly, tpoly);
                        fdiff = fg.geometry.coordinates;

                        if (fdiff && fdiff.length > 0) {
                            fisone = fdiff.length === 1;
                            if (fisone) {
                                // fresult = fresult.concat(fdiff);
                                frontpoly = polygon(fdiff)
                            }
                            else {
                                fresult = fresult.concat(fdiff[0]);
                            }
                            // result = result.concat(dd[0]);
                            if (fdiff.length > 1) frontpoly = polygon(fdiff[1]);
                        }

                        let bg = difference(backpoly, bpoly);
                        bdiff = bg.geometry.coordinates;

                        if (bdiff && bdiff.length > 0) {
                            bisone = bdiff.length === 1;
                            if (bisone) {
                                // bresult = bresult.concat(bdiff);
                                backpoly = polygon(bdiff)
                            }
                            else {
                                bresult = bresult.concat(bdiff[0]);
                            }
                            // result = result.concat(dd[0]);
                            if (bdiff.length > 1) backpoly = polygon(bdiff[1]);
                        }
                    }
                }
                fresult = fresult.concat(frontpoly.geometry.coordinates);
                bresult = bresult.concat(backpoly.geometry.coordinates);
            }
        }

        let ftarget: any[] = [];
        let foneVec: Vector2[];
        for (i = 0; i < fresult.length; i++) {
            foneVec = [];
            for (j = 0; j < fresult[i].length; j++) {
                foneVec.push(new Vector2(fresult[i][j][0], fresult[i][j][1]));
            }
            ftarget.push(foneVec);
        }

        let btarget: any[] = [];
        let oneVec: Vector2[];
        for (i = 0; i < fresult.length; i++) {
            oneVec = [];
            for (j = 0; j < fresult[i].length; j++) {
                oneVec.push(new Vector2(fresult[i][j][0], fresult[i][j][1]));
            }
            btarget.push(oneVec);
        }

        return { front: ftarget, back: btarget };
    }


    static getNormalSlotRightGapPath(iswall: boolean, data: ALParams, len: number,
        DJXQW: number, DJXQH: number, xzioxie: number[], syioxie: number[]) {

        let W: number = Number(data.W);
        let L: number = Number(data.L);
        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let frontPath: number[][], backPath: number[][];
        if (iswall) {
            frontPath = [
                [0, 0],
                [0, len - DJXQW],
                [DJXQH, len],
                [L, len],
                [L, 0],
                [0, 0]
            ]

            backPath = [
                [0, 0],
                [0, len - DJXQW],
                [DJXQH, len],
                [L, len],
                [L, 0],
                [0, 0]
            ]
        }
        else {
            frontPath = [
                [0 + xzioxie[5], 0],
                [0 + xzioxie[4], len],
                [L + syioxie[4], len],
                [L + syioxie[5], 0],
                [0 + xzioxie[5], 0]
            ]

            backPath = [
                [0 + xzioxie[11], 0],
                [0 + xzioxie[10], len],
                [L + syioxie[10], len],
                [L + syioxie[11], 0],
                [0 + xzioxie[11], 0]
            ]
        }

        let frontpoly = polygon([frontPath]);
        let backpoly = polygon([backPath]);

        let i: number, j: number;
        let fpathVec: number[][], bpathVec: number[][];
        let fdiff: any, bdiff: any;

        let fisone = false;
        let bisone = false;
        let fresult: any[] = [];
        let bresult: any[] = [];
        // 缺口
        if (QKH > 0 && QKW > 0) {

            let righttpos: number = 0;
            let ykqkdw = data.p_ykqkdw;
            let ykqkdwAry = ykqkdw.split(',');
            if (ykqkdwAry.length > 0 && ykqkdwAry[0] !== "") {

                for (i = 0; i < ykqkdwAry.length; i++) {
                    righttpos += Number(ykqkdwAry[i]);
                    if (righttpos > 0) {

                        let walltp = righttpos + QKW / 2;
                        let wallbp = righttpos - QKW / 2;

                        if (iswall) {

                            let walltlen: number;
                            if (walltp >= 0 && walltp < DJXQH) {
                                walltlen = walltp / DJXQH * DJXQW + len - DJXQW
                            }
                            else {
                                walltlen = len;
                            }

                            let wallblen: number;
                            if (wallbp >= 0 && wallbp < DJXQH) {
                                wallblen = wallbp / DJXQH * DJXQW + len - DJXQW
                            }
                            else {
                                wallblen = len;
                            }

                            fpathVec = [
                                [wallbp, 0],
                                [wallbp, wallblen],
                                [walltp, walltlen],
                                [walltp, 0],
                                [wallbp, 0]
                            ]
                            bpathVec = [
                                [wallbp, 0],
                                [wallbp, wallblen],
                                [walltp, walltlen],
                                [walltp, 0],
                                [wallbp, 0]
                            ]
                        }
                        else {
                            fpathVec = [
                                [wallbp, 0],
                                [wallbp, len],
                                [walltp, len],
                                [walltp, 0],
                                [wallbp, 0]
                            ]

                            bpathVec = [
                                [wallbp, 0],
                                [wallbp, len],
                                [walltp, len],
                                [walltp, 0],
                                [wallbp, 0]
                            ]
                        }

                        let tpoly = polygon([fpathVec]);
                        let bpoly = polygon([bpathVec]);

                        let fg = difference(frontpoly, tpoly);
                        fdiff = fg.geometry.coordinates;


                        if (fdiff && fdiff.length > 0) {
                            fisone = fdiff.length === 1;
                            if (fisone) {
                                // fresult = fresult.concat(fdiff);
                                frontpoly = polygon(fdiff)
                            }
                            else {
                                fresult = fresult.concat(fdiff[0]);
                            }
                            // result = result.concat(dd[0]);
                            if (fdiff.length > 1) frontpoly = polygon(fdiff[1]);
                        }

                        let bg = difference(backpoly, bpoly);
                        bdiff = bg.geometry.coordinates;

                        if (bdiff && bdiff.length > 0) {
                            bisone = bdiff.length === 1;
                            if (bisone) {
                                // bresult = bresult.concat(bdiff);
                                backpoly = polygon(bdiff)
                            }
                            else {
                                bresult = bresult.concat(bdiff[0]);
                            }
                            // result = result.concat(dd[0]);
                            if (bdiff.length > 1) backpoly = polygon(bdiff[1]);
                        }
                    }
                }

                fresult = fresult.concat(frontpoly.geometry.coordinates);
                bresult = bresult.concat(backpoly.geometry.coordinates);
            }

        }

        let ftarget: any[] = [];
        let foneVec: Vector2[];
        for (i = 0; i < fresult.length; i++) {
            foneVec = [];
            for (j = 0; j < fresult[i].length; j++) {
                foneVec.push(new Vector2(fresult[i][j][0], fresult[i][j][1]));
            }
            ftarget.push(foneVec);
        }

        let btarget: any[] = [];
        let oneVec: Vector2[];
        for (i = 0; i < fresult.length; i++) {
            oneVec = [];
            for (j = 0; j < fresult[i].length; j++) {
                oneVec.push(new Vector2(fresult[i][j][0], fresult[i][j][1]));
            }
            btarget.push(oneVec);
        }

        return { front: ftarget, back: btarget };
    }


    static getLeftSlotFengVI(count: number, vertices: number[], indices: number[], facevec: Vector3[][],
        fone: Vector2[], bone: Vector2[], holes: Path[], W: number, cosA: number, sinA: number, data: ALParams): number {

        let topface: Vector3[] = [];
        let bottomface: Vector3[] = [];
        let top: Vector3, bottom: Vector3;
        let adv = data.p_zksctype === 1 ? - cosA : data.p_zksctype === 2 ? cosA : 0;

        for (let i = 0; i < fone.length; i++) {

            top = new Vector3(fone[i].x * sinA, fone[i].y, W - data.ZYKH + fone[i].x * adv);

            bottom = new Vector3(bone[i].x * sinA, bone[i].y, W + bone[i].x * adv);

            topface.push(top);
            bottomface.push(bottom);
        }

        let topvec = topface.concat(topface[0].clone());
        let bottomvec = bottomface.concat(bottomface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 前后面
        let shape = new Shape().setFromPoints(fone);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let posAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();

        let vertex: any[] = []
        let index: any[] = [];

        for (let i = 0; i < posAry.array.length; i += 3) {

            let a = posAry.array[i];
            let b = posAry.array[i + 1];
            let c = posAry.array[i + 2];
            vertex.push(a * sinA, b, W - data.ZYKH + a * adv);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse()
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface);

        count = Math.max(...indices) + 1;

        // 前后面
        shape = new Shape().setFromPoints(bone);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        geometry = new ShapeGeometry(shape);
        posAry = geometry.attributes.position;
        indexAry = geometry.getIndex();

        vertex = []
        index = [];

        for (let i = 0; i < posAry.array.length; i += 3) {

            let a = posAry.array[i];
            let b = posAry.array[i + 1];
            let c = posAry.array[i + 2];
            vertex.push(a * sinA, b, W + a * adv)
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse()
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface);

        count = Math.max(...indices) + 1;

        geometry.dispose();

        return count;
    }

    static getRightSlotFengVI(count: number, vertices: number[], indices: number[], facevec: Vector3[][], fone: Vector2[], bone: Vector2[], holes: Path[], H: number, cosA: number, sinA: number, data: ALParams): number {
        let topface: Vector3[] = [];
        let bottomface: Vector3[] = [];
        let top: Vector3, bottom: Vector3;
        let adv = data.p_yksctype === 1 ? - cosA : data.p_yksctype === 2 ? cosA : 0;
        let ra = data.p_yksctype === 0 ? 1 : sinA;
        for (let i = 0; i < fone.length; i++) {

            top = new Vector3(H + fone[i].y * adv, fone[i].x, fone[i].y * ra);

            bottom = new Vector3(H - data.ZYKH + bone[i].y * adv, bone[i].x, bone[i].y * ra);

            topface.push(top);
            bottomface.push(bottom);
        }

        let topvec = topface.concat(topface[0].clone());
        let bottomvec = bottomface.concat(bottomface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 前后面
        let shape = new Shape().setFromPoints(fone);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let posAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();

        let vertex: any[] = []
        let index: any[] = [];

        for (let i = 0; i < posAry.array.length; i += 3) {

            let a = posAry.array[i];
            let b = posAry.array[i + 1];
            let c = posAry.array[i + 2];
            vertex.push(H + b * adv, a, b * ra);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse()
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface);

        count = Math.max(...indices) + 1;

        // 前后面
        shape = new Shape().setFromPoints(bone);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        geometry = new ShapeGeometry(shape);
        posAry = geometry.attributes.position;
        indexAry = geometry.getIndex();

        vertex = []
        index = [];

        for (let i = 0; i < posAry.array.length; i += 3) {

            let a = posAry.array[i];
            let b = posAry.array[i + 1];
            let c = posAry.array[i + 2];
            vertex.push(H - data.ZYKH + b * adv, a, b * ra)
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse()
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(bottomface);

        count = Math.max(...indices) + 1;

        geometry.dispose();

        return count;
    }

    static getVectorMinX(a: Vector2[], b: Vector2[], isy: boolean = false): number[] {
        let c = a.concat(b);
        let xv: number[] = [];
        for (let i = 0; i < c.length; i++) {
            isy ? xv.push(c[i].y) : xv.push(c[i].x);
        }
        let max = Math.max.apply(Math, xv);
        let min = Math.min.apply(Math, xv);
        return [max, min];

    }

    /**
     * 普通/墙角 C 槽
     * @param iswall 
     * @param data 
     * @returns 
     */
    static getSlotVI(iswall: boolean, data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let radian = data.XBNXJD / 180 * Math.PI;
        let cosA = Math.cos(radian);
        let sinA = Math.sin(radian);
        let tanA = Math.tan(radian);

        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        let H = Number(data.H);
        let W = Number(data.W);
        let L = Number(data.L);

        let DJXQW = Number(data.DJXQW);
        let DJXQH = Number(data.DJXQH);

        // 缺口
        let QKH: number = Number(data.p_qkh);
        let QKW: number = Number(data.p_qkw);

        let top: Vector3, bottom: Vector3, topface: Vector3[], bottomface: Vector3[];
        let xv: number, yv: number, i: number;
        let backPath: Vector2[], frontPath: Vector2[];

        let len: number = data.BKH;

        let xzioxie = MoldUtils.getIOXie(tanA, sinA, W, H, data.XQNXJL, data.BKH, data.GMT, data.ZYKH, data.p_zksctype, data.p_yksctype, data.p_xzxqtype, false);
        let syioxie = MoldUtils.getIOXie(tanA, sinA, W, H, data.XQNXJL, data.BKH, data.GMT, data.ZYKH, data.p_zksctype, data.p_yksctype, data.p_syxqtype, true);

        //左面孔
        if (W === 50 && H != 50) {
            // 不生成左面孔

        }
        else {

            len = data.p_zksctype === 1 ? -data.GMT / tanA : data.p_zksctype === 2 ? data.GMT / tanA : 0;

            // 左缺口
            // let leftpqk = Number(data.p_zkqkdw);

            let leftpathv = MoldUtils.getLeftSlotGapPath(data, xzioxie, syioxie, L, W, len);

            if (QKH > 0 && QKW > 0 && MoldUtils.haveData(leftpathv) && QKH < W) {
                backPath = leftpathv[0];
                frontPath = leftpathv[1];
            }
            else {
                backPath = [
                    new Vector2(0 + xzioxie[0], 0),
                    new Vector2(L + syioxie[0], 0),
                    new Vector2(L + syioxie[1], W),
                    new Vector2(0 + xzioxie[1], W)
                ];

                frontPath = [
                    new Vector2(0 + xzioxie[6], 0),
                    new Vector2(L + syioxie[6], 0),
                    new Vector2(L + syioxie[7], W + len),
                    new Vector2(0 + xzioxie[7], W + len)
                ];

            }

            holes = [];
            MoldUtils.getGmtHoles(data.p_l_r1, data.p_l_r1dw, holes, 1);
            MoldUtils.getGmtHoles(data.p_l_r2, data.p_l_r2dw, holes, 1);
            MoldUtils.getGmtHoles(data.p_l_r3, data.p_l_r3dw, holes, 1);

            count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, holes, 1, 0, data.GMT, false, true);
        }


        // 右面孔
        if (H === 50 && W != 50) {
            // 不生成右面孔
        }
        else {

            len = data.p_yksctype === 1 ? -data.GMT / tanA : data.p_yksctype === 2 ? data.GMT / tanA : 0;

            // 左缺口
            // let rightpqk = Number(data.p_ykqkdw);

            let rightpathv = MoldUtils.getRightSlotGapPath(data, xzioxie, syioxie, L, H, len);

            if (QKH > 0 && QKW > 0 && MoldUtils.haveData(rightpathv) && QKH < H) {
                frontPath = rightpathv[0];
                backPath = rightpathv[1];
            }
            else {
                backPath = [
                    new Vector2(0, 0 + xzioxie[0]),
                    new Vector2(H, 0 + xzioxie[5]),
                    new Vector2(H, L + syioxie[5]),
                    new Vector2(0, L + syioxie[0])
                ];

                frontPath = [
                    new Vector2(0, 0 + xzioxie[12]),
                    new Vector2(H + len, 0 + xzioxie[13]),
                    new Vector2(H + len, L + syioxie[13]),
                    new Vector2(0, L + syioxie[12])
                ];

            }

            holes = [];
            MoldUtils.getGmtHoles(data.p_r_r1, data.p_r_r1dw, holes, 0);
            MoldUtils.getGmtHoles(data.p_r_r2, data.p_r_r2dw, holes, 0);
            MoldUtils.getGmtHoles(data.p_r_r3, data.p_r_r3dw, holes, 0);

            count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, holes, 0, 0, data.GMT, false, true);
        }

        // 左前
        let zqpos = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
        if (W === 50 && H != 50) {
            path = iswall ? [
                new Vector2(0, 0),
                new Vector2(0, W + DJXQW),
                new Vector2(DJXQH, W + data.BKH),
                new Vector2(L, W + data.BKH),
                new Vector2(L, 0)
            ] : [
                new Vector2(0, 0),
                new Vector2(0, W + data.BKH),
                new Vector2(L, W + data.BKH),
                new Vector2(L, 0)
            ];
            holes = [];

            for (i = 0; i < zqpos.length; i++) {
                xv = zqpos[i];
                yv = W + data.BKH - data.BKKJMDis;

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);
                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, 0, data.ZYKH, false);
        }
        else {

            len = data.p_zksctype === 0 ? data.BKH : data.BKH / sinA;
            // let zqpos = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);

            // 右缺口
            // let leftbpqk = Number(data.p_ykqkdw);
            // 缺口值
            let leftpv = MoldUtils.getNormalSlotLeftGapPath(iswall, data, len, DJXQW, DJXQH, xzioxie, syioxie);
            let leftqkvec = [leftpv.front, leftpv.back];

            if (QKH > 0 && QKW > 0 && MoldUtils.haveData(leftqkvec) && QKH < W) {

                for (i = 0; i < leftqkvec[0].length; i++) {

                    let fone = leftqkvec[0][i].concat();
                    let bone = leftqkvec[1][i].concat();

                    let minvecx = MoldUtils.getVectorMinX(fone, bone, true);

                    holes = [];
                    for (let j = 0; j < zqpos.length; j++) {
                        xv = data.BKH - data.BKKJMDis;
                        yv = zqpos[j];

                        if (yv > minvecx[0] - data.BKDia / 2 || yv < minvecx[1] + data.BKDia / 2) {
                            continue;
                        }

                        if (data.p_xzxqtype === 4) {
                            if (yv < data.XQNXJL + data.BKDia / 2) {
                                continue;
                            }
                        }
                        if (data.p_syxqtype === 4) {

                            if (yv > L - data.XQNXJL - data.BKDia / 2) {
                                continue;
                            }
                        }

                        holePath = new Path()
                            .moveTo(xv, yv)
                            .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);
                        holes.push(holePath);
                    }
                    count = MoldUtils.getLeftSlotFengVI(count, vertices, indices, facevec, fone, bone, holes, W, cosA, sinA, data);
                }
            }
            else {
                if (iswall) {
                    frontPath = [
                        new Vector2(0, 0),
                        new Vector2(len - DJXQW, 0),
                        new Vector2(len, DJXQH),
                        new Vector2(len, L),
                        new Vector2(0, L)
                    ]

                    backPath = [
                        new Vector2(0, 0),
                        new Vector2(len - DJXQW, 0),
                        new Vector2(len, DJXQH),
                        new Vector2(len, L),
                        new Vector2(0, L)
                    ]

                }
                else {
                    frontPath = [
                        new Vector2(0, 0 + xzioxie[1]),
                        new Vector2(len, 0 + xzioxie[2]),
                        new Vector2(len, L + syioxie[2]),
                        new Vector2(0, L + syioxie[1])
                    ]
                    backPath = [
                        new Vector2(0, 0 + xzioxie[8]),
                        new Vector2(len, 0 + xzioxie[9]),
                        new Vector2(len, L + syioxie[9]),
                        new Vector2(0, L + syioxie[8])
                    ]
                }

                // 左框常规内外斜
                holes = [];

                for (i = 0; i < zqpos.length; i++) {
                    xv = data.BKH - data.BKKJMDis;
                    yv = zqpos[i];

                    if (data.p_xzxqtype === 4) {
                        if (yv < data.XQNXJL + data.BKDia / 2) {
                            continue;
                        }
                    }
                    if (data.p_syxqtype === 4) {

                        if (yv > L - data.XQNXJL - data.BKDia / 2) {
                            continue;
                        }
                    }

                    holePath = new Path()
                        .moveTo(xv, yv)
                        .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);
                    holes.push(holePath);
                }

                if (data.p_zksctype === 0) {
                    count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, holes, 0, W - data.ZYKH, W, false, true);
                }
                else if (data.p_zksctype === 1) {
                    // 内斜
                    count = MoldUtils.getXieShapeVI(count, vertices, indices, facevec, frontPath, backPath, holes, sinA, cosA, 0, 0, W - data.ZYKH, W, false, true)
                }
                else if (data.p_zksctype === 2) {
                    // 外斜
                    count = MoldUtils.getXieShapeVI(count, vertices, indices, facevec, frontPath, backPath, holes, sinA, cosA, 1, 0, W - data.ZYKH, W, false, true)
                }
            }
        }


        // 右侧
        let ycpos = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
        if (H === 50 && W != 50) {

            path = iswall ? [
                new Vector2(0, 0),
                new Vector2(H + DJXQW, 0),
                new Vector2(H + data.BKH, DJXQH),
                new Vector2(H + data.BKH, L),
                new Vector2(0, L)
            ] : [
                new Vector2(0, 0),
                new Vector2(H + data.BKH, 0),
                new Vector2(H + data.BKH, L),
                new Vector2(0, L)
            ]

            holes = [];

            for (i = 0; i < ycpos.length; i++) {
                xv = H + data.BKH - data.BKKJMDis;
                yv = ycpos[i];



                let holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.ZYKH, 0, true);
        }
        else {

            len = data.p_yksctype === 0 ? data.BKH : data.BKH / sinA;
            // let ycpos = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
            // 右缺口

            // 缺口值
            let rightpv = MoldUtils.getNormalSlotRightGapPath(iswall, data, len, DJXQW, DJXQH, xzioxie, syioxie);
            let rigthqkvec = [rightpv.front, rightpv.back];
            if (QKH > 0 && QKW > 0 && MoldUtils.haveData(rigthqkvec) && QKH < H) {

                for (i = 0; i < rigthqkvec[0].length; i++) {

                    let fone = rigthqkvec[0][i].concat();
                    let bone = rigthqkvec[1][i].concat();

                    let minvecx = MoldUtils.getVectorMinX(fone, bone);

                    holes = [];
                    for (let j = 0; j < ycpos.length; j++) {
                        xv = ycpos[j];
                        yv = data.BKH - data.BKKJMDis;

                        if (xv > minvecx[0] - data.BKDia / 2 || xv < minvecx[1] + data.BKDia / 2) {
                            continue;
                        }

                        if (data.p_xzxqtype === 2) {
                            if (xv < data.XQNXJL + data.BKDia / 2) {
                                continue;
                            }
                        }
                        if (data.p_syxqtype === 2) {

                            if (xv > L - data.XQNXJL - data.BKDia / 2) {
                                continue;
                            }
                        }

                        holePath = new Path()
                            .moveTo(xv, yv)
                            .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                        holes.push(holePath);
                    }

                    count = MoldUtils.getRightSlotFengVI(count, vertices, indices, facevec, fone, bone, holes, H, cosA, sinA, data);
                }

            }
            else {
                if (iswall) {
                    frontPath = [
                        new Vector2(0, 0),
                        new Vector2(0, len - DJXQW),
                        new Vector2(DJXQH, len),
                        new Vector2(L, len),
                        new Vector2(L, 0)
                    ]

                    backPath = [
                        new Vector2(0, 0),
                        new Vector2(0, len - DJXQW),
                        new Vector2(DJXQH, len),
                        new Vector2(L, len),
                        new Vector2(L, 0)
                    ]
                }
                else {
                    frontPath = [
                        new Vector2(0 + xzioxie[5], 0),
                        new Vector2(0 + xzioxie[4], len),
                        new Vector2(L + syioxie[4], len),
                        new Vector2(L + syioxie[5], 0)
                    ]

                    backPath = [
                        new Vector2(0 + xzioxie[11], 0),
                        new Vector2(0 + xzioxie[10], len),
                        new Vector2(L + syioxie[10], len),
                        new Vector2(L + syioxie[11], 0)
                    ]
                }


                holes = [];
                for (i = 0; i < ycpos.length; i++) {
                    xv = ycpos[i];
                    yv = data.BKH - data.BKKJMDis;

                    if (data.p_xzxqtype === 2) {
                        if (xv < data.XQNXJL + data.BKDia / 2) {
                            continue;
                        }
                    }
                    if (data.p_syxqtype === 2) {

                        if (xv > L - data.XQNXJL - data.BKDia / 2) {
                            continue;
                        }
                    }

                    let holePath = new Path();
                    holePath.moveTo(xv, yv)
                        .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                    holes.push(holePath);
                }

                if (data.p_yksctype === 0) {
                    count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, holes, 1, H - data.ZYKH, H, false);
                }
                else if (data.p_yksctype === 1) {
                    // 内斜
                    count = MoldUtils.getXieShapeVI(count, vertices, indices, facevec, frontPath, backPath, holes, sinA, cosA, 0, 1, H - data.ZYKH, H, false)
                }
                else if (data.p_yksctype === 2) {
                    // 外斜
                    count = MoldUtils.getXieShapeVI(count, vertices, indices, facevec, frontPath, backPath, holes, sinA, cosA, 1, 1, H - data.ZYKH, H, false)
                }
            }
        }

        // 顶/底封板

        holes = [];
        let zypk = AModelFmulaUtils.getHolesbyExpress(data.p_zypkk, W, 2);
        let yypk = AModelFmulaUtils.getHolesbyExpress(data.p_yypkk, H, 2);;

        if (W != 50) {
            // 左平孔-宽
            for (i = 0; i < zypk.length; i++) {
                xv = data.BKH - data.BKKJMDis;
                yv = zypk[i];
                if (yv > W - data.BKDia / 2) {
                    continue;
                }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
        }

        if (H != 50) {
            // 右平孔-高
            for (i = 0; i < yypk.length; i++) {
                xv = yypk[i];
                yv = data.BKH - data.BKKJMDis;
                if (xv > H - data.BKDia / 2) {
                    continue;
                }
                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
        }

        if ((W == 100 && H == 100)) {

            holes = [];
            let tfone = new Vector2(data.BKH - data.BKKJMDis, zypk[0]);
            let tftwo = new Vector2(yypk[0], data.BKH - data.BKKJMDis);

            holePath = MoldUtils.getCapsulePath(tfone, tftwo, data.BKDia / 2, true);
            holes.push(holePath);

        }


        let lbv = data.p_zksctype === 1 ? -data.BKH / tanA : data.p_zksctype === 2 ? data.BKH / tanA : 0;
        let rbv = data.p_yksctype === 1 ? -data.BKH / tanA : data.p_yksctype === 2 ? data.BKH / tanA : 0;

        let HC = MoldUtils.SqrtValue(data.XQNXJL, H);
        let WC = MoldUtils.SqrtValue(data.XQNXJL, W);

        let sinB: number, cosB: number;
        if (H === 50 && W != 50) {

            path = data.p_syfentype === 1 ? [
                new Vector2(0, 0),
                new Vector2(0, W),
                new Vector2(H, W),
                new Vector2(W, 0)
            ] : [
                new Vector2(0, 0),
                new Vector2(0, W),
                new Vector2(data.BKH, W + lbv),
                new Vector2(data.BKH, 0)
            ]
            if (data.p_syfentype === 0) {
                count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, L, L - data.SXKH, false);
            }
            else if (data.p_syfentype === 1) {
                count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, L, L - data.SXKH, false);
            }

            if (!iswall) {
                path = data.p_xzfentype === 1 ? [
                    new Vector2(0, 0),
                    new Vector2(0, W),
                    new Vector2(H, W),
                    new Vector2(W, 0)
                ] : [
                    new Vector2(0, 0),
                    new Vector2(0, W),
                    new Vector2(data.BKH, W + lbv),
                    new Vector2(data.BKH, 0)
                ]
                if (data.p_xzfentype === 0) {
                    count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, data.SXKH, 0, false);
                }
                else if (data.p_xzfentype === 1) {
                    count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, data.SXKH, 0, false);
                }

            }
        }
        else if (W === 50 && H != 50) {

            path = data.p_syfentype === 1 ? [
                new Vector2(0, 0),
                new Vector2(0, W),
                new Vector2(H, W),
                new Vector2(W, 0)
            ] : [
                new Vector2(0, 0),
                new Vector2(0, data.BKH),
                new Vector2(H + rbv, data.BKH),
                new Vector2(H, 0)
            ]
            if (data.p_syfentype != 2) {
                count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, L, L - data.SXKH, false);
            }
            if (!iswall) {
                path = data.p_xzfentype === 1 ? [
                    new Vector2(0, 0),
                    new Vector2(0, W),
                    new Vector2(H, W),
                    new Vector2(W, 0)
                ] : [
                    new Vector2(0, 0),
                    new Vector2(0, data.BKH),
                    new Vector2(H + rbv, data.BKH),
                    new Vector2(H, 0)
                ]
                if (data.p_xzfentype === 0) {
                    count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, data.SXKH, 0, false);
                }
                else if (data.p_xzfentype === 1) {
                    count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, data.SXKH, 0, false);
                }
            }
        }
        else {

            if (data.p_syfentype === 2) {

            }
            else {
                if (data.p_syxqtype === 1) {
                    cosB = H / HC;
                    sinB = data.XQNXJL / HC;
                    path = data.p_syfentype === 1 ? [
                        new Vector2(0, 0),
                        new Vector2(0, W),
                        new Vector2(H / cosB, W),
                        new Vector2(H / cosB, 0)
                    ] : [
                        new Vector2(0, 0),
                        new Vector2(0, W),
                        new Vector2(data.BKH / cosB, W + lbv),
                        new Vector2(data.BKH / cosB, data.BKH),
                        new Vector2((H + rbv) / cosB, data.BKH),
                        new Vector2(H / cosB, 0)
                    ]

                    topface = [];
                    bottomface = [];
                    for (i = 0; i < path.length; i++) {

                        top = new Vector3(path[i].x * cosB, L + path[i].x * sinB, path[i].y);

                        bottom = new Vector3(path[i].x * cosB, L - data.SXKH + path[i].x * sinB, path[i].y);

                        topface.push(top);
                        bottomface.push(bottom);
                    }

                    let topvec = topface.concat(topface[0].clone());
                    let bottomvec = bottomface.concat(bottomface[0].clone());

                    // 侧边
                    let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
                    vertices.push(...side[0]);
                    indices.push(...side[1]);
                    facevec.push(...side[2]);
                    count = side[3];


                    // 前后面
                    let shape = new Shape().setFromPoints(path);
                    // 挖孔
                    if (data.p_syfentype != 1 && holes && holes.length > 0) {
                        shape.holes.push(...holes);
                    }

                    let geometry = new ShapeGeometry(shape);
                    let positionAry = geometry.attributes.position;
                    let indexAry = geometry.getIndex();


                    // 顶点
                    let vertex: any[] = []
                    let index: any[] = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a * cosB, L + a * sinB, b);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }

                    index.reverse();
                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(topface);

                    count = Math.max(...indices) + 1;


                    // 顶点
                    vertex = []
                    index = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a * cosB, L - data.SXKH + a * sinB, b);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }


                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(topface);

                    count = Math.max(...indices) + 1;
                }
                else if (data.p_syxqtype === 2) {
                    cosB = H / HC;
                    sinB = data.XQNXJL / HC;
                    path = data.p_syfentype === 1 ? [
                        new Vector2(0, 0),
                        new Vector2(0, W),
                        new Vector2(H / cosB, W),
                        new Vector2(H / cosB, 0)
                    ] : [
                        new Vector2(0, 0),
                        new Vector2(0, W),
                        new Vector2(data.BKH / cosB, W + lbv),
                        new Vector2(data.BKH / cosB, data.BKH),
                        new Vector2((H + rbv) / cosB, data.BKH),
                        new Vector2(H / cosB, 0)
                    ]
                    topface = [];
                    bottomface = [];
                    for (i = 0; i < path.length; i++) {

                        top = new Vector3(path[i].x * cosB, L - path[i].x * sinB, path[i].y);

                        bottom = new Vector3(path[i].x * cosB, L - data.SXKH - path[i].x * sinB, path[i].y);

                        topface.push(top);
                        bottomface.push(bottom);
                    }

                    let topvec = topface.concat(topface[0].clone());
                    let bottomvec = bottomface.concat(bottomface[0].clone());

                    // 侧边
                    let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
                    vertices.push(...side[0]);
                    indices.push(...side[1]);
                    facevec.push(...side[2]);
                    count = side[3];

                    // 前后面
                    let shape = new Shape().setFromPoints(path);
                    // 挖孔
                    if (data.p_syfentype != 1 && holes && holes.length > 0) {
                        shape.holes.push(...holes);
                    }

                    let geometry = new ShapeGeometry(shape);
                    let positionAry = geometry.attributes.position;
                    let indexAry = geometry.getIndex();


                    // 顶点
                    let vertex: any[] = []
                    let index: any[] = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a * cosB, L - a * sinB, b);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }

                    index.reverse();
                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(topface);

                    count = Math.max(...indices) + 1;


                    // 顶点
                    vertex = []
                    index = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a * cosB, L - data.SXKH - a * sinB, b);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }


                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(bottomface);

                    count = Math.max(...indices) + 1;

                }
                else if (data.p_syxqtype === 3) {
                    cosB = W / WC;
                    sinB = data.XQNXJL / WC;
                    path = data.p_syfentype === 1 ? [
                        new Vector2(0, 0),
                        new Vector2(0, W / cosB),
                        new Vector2(H, W / cosB),
                        new Vector2(H, 0)
                    ] : [
                        new Vector2(0, 0),
                        new Vector2(0, W / cosB),
                        new Vector2(data.BKH, (W + lbv) / cosB),
                        new Vector2(data.BKH, data.BKH / cosB),
                        new Vector2((H + rbv), data.BKH / cosB),
                        new Vector2(H, 0)
                    ];


                    topface = [];
                    bottomface = [];
                    for (i = 0; i < path.length; i++) {

                        top = new Vector3(path[i].x, L + path[i].y * sinB, path[i].y * cosB);

                        bottom = new Vector3(path[i].x, L - data.SXKH + path[i].y * sinB, path[i].y * cosB);

                        topface.push(top);
                        bottomface.push(bottom);
                    }

                    let topvec = topface.concat(topface[0].clone());
                    let bottomvec = bottomface.concat(bottomface[0].clone());

                    // 侧边
                    let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
                    vertices.push(...side[0]);
                    indices.push(...side[1]);
                    facevec.push(...side[2]);
                    count = side[3];

                    // 前后面
                    let shape = new Shape().setFromPoints(path);
                    // 挖孔
                    if (data.p_syfentype != 1 && holes && holes.length > 0) {
                        shape.holes.push(...holes);
                    }

                    let geometry = new ShapeGeometry(shape);
                    let positionAry = geometry.attributes.position;
                    let indexAry = geometry.getIndex();


                    // 顶点
                    let vertex: any[] = []
                    let index: any[] = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a, L + b * sinB, b * cosB);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }

                    index.reverse();
                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(topface);

                    count = Math.max(...indices) + 1;


                    // 顶点
                    vertex = []
                    index = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a, L - data.SXKH + b * sinB, b * cosB);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }


                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(bottomface);

                    count = Math.max(...indices) + 1;

                }
                else if (data.p_syxqtype === 4) {
                    cosB = W / WC;
                    sinB = data.XQNXJL / WC;
                    path = data.p_syfentype === 1 ? [
                        new Vector2(0, 0),
                        new Vector2(0, W / cosB),
                        new Vector2(H, W / cosB),
                        new Vector2(H, 0)
                    ] : [
                        new Vector2(0, 0),
                        new Vector2(0, W / cosB),
                        new Vector2(data.BKH, (W + lbv) / cosB),
                        new Vector2(data.BKH, data.BKH / cosB),
                        new Vector2((H + rbv), data.BKH / cosB),
                        new Vector2(H, 0)
                    ]

                    topface = [];
                    bottomface = [];
                    for (i = 0; i < path.length; i++) {

                        top = new Vector3(path[i].x, L - path[i].y * sinB, path[i].y * cosB);

                        bottom = new Vector3(path[i].x, L - data.SXKH - path[i].y * sinB, path[i].y * cosB);

                        topface.push(top);
                        bottomface.push(bottom);
                    }

                    let topvec = topface.concat(topface[0].clone());
                    let bottomvec = bottomface.concat(bottomface[0].clone());

                    // 侧边
                    let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
                    vertices.push(...side[0]);
                    indices.push(...side[1]);
                    facevec.push(...side[2]);
                    count = side[3];

                    // 前后面
                    let shape = new Shape().setFromPoints(path);
                    // 挖孔
                    if (data.p_syfentype != 1 && holes && holes.length > 0) {
                        shape.holes.push(...holes);
                    }

                    let geometry = new ShapeGeometry(shape);
                    let positionAry = geometry.attributes.position;
                    let indexAry = geometry.getIndex();


                    // 顶点
                    let vertex: any[] = []
                    let index: any[] = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a, L - b * sinB, b * cosB);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }

                    index.reverse();
                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(topface);

                    count = Math.max(...indices) + 1;


                    // 顶点
                    vertex = []
                    index = [];

                    for (let i = 0; i < positionAry.array.length; i += 3) {

                        let a = positionAry.array[i];
                        let b = positionAry.array[i + 1];
                        let c = positionAry.array[i + 2];

                        vertex.push(a, L - data.SXKH - b * sinB, b * cosB);
                    }

                    // 索引
                    for (let i = 0; i < indexAry.array.length; i += 3) {
                        let a = indexAry.array[i] + count;
                        let b = indexAry.array[i + 1] + count;
                        let c = indexAry.array[i + 2] + count;

                        index.push(a, b, c);
                    }


                    vertices.push(...vertex);
                    indices.push(...index);
                    facevec.push(bottomface);

                    count = Math.max(...indices) + 1;
                }
                else {
                    if (data.p_syfentype === 1) {
                        path = [
                            new Vector2(0, 0),
                            new Vector2(0, W),
                            new Vector2(H, W),
                            new Vector2(H, 0)
                        ]
                        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, L, L - data.SXKH, false);
                    }
                    else {
                        path = [
                            new Vector2(0, 0),
                            new Vector2(0, W),
                            new Vector2(data.BKH, W + lbv),
                            new Vector2(data.BKH, data.BKH),
                            new Vector2((H + rbv), data.BKH),
                            new Vector2(H, 0)
                        ]
                        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, L, L - data.SXKH, false);
                    }

                }
            }

            if (!iswall) {


                if (data.p_xzfentype === 2) {

                }
                else {
                    // 下封
                    if (data.p_xzxqtype === 1) {
                        cosB = H / HC;
                        sinB = data.XQNXJL / HC;
                        path = data.p_syfentype === 1 ? [
                            new Vector2(0, 0),
                            new Vector2(0, W),
                            new Vector2(H / cosB, W),
                            new Vector2(H / cosB, 0)
                        ] : [
                            new Vector2(0, 0),
                            new Vector2(0, W),
                            new Vector2(data.BKH / cosB, W + lbv),
                            new Vector2(data.BKH / cosB, data.BKH),
                            new Vector2((H + rbv) / cosB, data.BKH),
                            new Vector2(H / cosB, 0)
                        ]

                        topface = [];
                        bottomface = [];
                        for (i = 0; i < path.length; i++) {

                            top = new Vector3(path[i].x * cosB, -path[i].x * sinB, path[i].y);

                            bottom = new Vector3(path[i].x * cosB, data.SXKH - path[i].x * sinB, path[i].y);

                            topface.push(top);
                            bottomface.push(bottom);
                        }

                        let topvec = topface.concat(topface[0].clone());
                        let bottomvec = bottomface.concat(bottomface[0].clone());

                        // 侧边
                        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
                        vertices.push(...side[0]);
                        indices.push(...side[1]);
                        facevec.push(...side[2]);
                        count = side[3];


                        // 前后面
                        let shape = new Shape().setFromPoints(path);
                        // 挖孔
                        if (data.p_syfentype != 1 && holes && holes.length > 0) {
                            shape.holes.push(...holes);
                        }

                        let geometry = new ShapeGeometry(shape);
                        let positionAry = geometry.attributes.position;
                        let indexAry = geometry.getIndex();


                        // 顶点
                        let vertex: any[] = []
                        let index: any[] = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a * cosB, - a * sinB, b);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }


                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(topface);

                        count = Math.max(...indices) + 1;


                        // 顶点
                        vertex = []
                        index = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a * cosB, data.SXKH - a * sinB, b);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }

                        index.reverse();
                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(topface);

                        count = Math.max(...indices) + 1;
                    }
                    else if (data.p_xzxqtype === 2) {
                        cosB = H / HC;
                        sinB = data.XQNXJL / HC;
                        path = path = data.p_syfentype === 1 ? [
                            new Vector2(0, 0),
                            new Vector2(0, W),
                            new Vector2(H / cosB, W),
                            new Vector2(H / cosB, 0)
                        ] : [
                            new Vector2(0, 0),
                            new Vector2(0, W),
                            new Vector2(data.BKH / cosB, W + lbv),
                            new Vector2(data.BKH / cosB, data.BKH),
                            new Vector2((H + rbv) / cosB, data.BKH),
                            new Vector2(H / cosB, 0)
                        ]
                        topface = [];
                        bottomface = [];
                        for (i = 0; i < path.length; i++) {

                            top = new Vector3(path[i].x * cosB, path[i].x * sinB, path[i].y);

                            bottom = new Vector3(path[i].x * cosB, data.SXKH + path[i].x * sinB, path[i].y);

                            topface.push(top);
                            bottomface.push(bottom);
                        }

                        let topvec = topface.concat(topface[0].clone());
                        let bottomvec = bottomface.concat(bottomface[0].clone());

                        // 侧边
                        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
                        vertices.push(...side[0]);
                        indices.push(...side[1]);
                        facevec.push(...side[2]);
                        count = side[3];

                        // 前后面
                        let shape = new Shape().setFromPoints(path);
                        // 挖孔
                        if (data.p_syfentype != 1 && holes && holes.length > 0) {
                            shape.holes.push(...holes);
                        }

                        let geometry = new ShapeGeometry(shape);
                        let positionAry = geometry.attributes.position;
                        let indexAry = geometry.getIndex();


                        // 顶点
                        let vertex: any[] = []
                        let index: any[] = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a * cosB, a * sinB, b);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }


                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(topface);

                        count = Math.max(...indices) + 1;


                        // 顶点
                        vertex = []
                        index = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a * cosB, data.SXKH + a * sinB, b);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }

                        index.reverse();
                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(bottomface);

                        count = Math.max(...indices) + 1;

                    }
                    else if (data.p_xzxqtype === 3) {
                        cosB = W / WC;
                        sinB = data.XQNXJL / WC;
                        path = data.p_syfentype === 1 ? [
                            new Vector2(0, 0),
                            new Vector2(0, W / cosB),
                            new Vector2(H, W / cosB),
                            new Vector2(H, 0)
                        ] : [
                            new Vector2(0, 0),
                            new Vector2(0, W / cosB),
                            new Vector2(data.BKH, (W + lbv) / cosB),
                            new Vector2(data.BKH, data.BKH / cosB),
                            new Vector2((H + rbv), data.BKH / cosB),
                            new Vector2(H, 0)
                        ];


                        topface = [];
                        bottomface = [];
                        for (i = 0; i < path.length; i++) {

                            top = new Vector3(path[i].x, - path[i].y * sinB, path[i].y * cosB);

                            bottom = new Vector3(path[i].x, data.SXKH - path[i].y * sinB, path[i].y * cosB);

                            topface.push(top);
                            bottomface.push(bottom);
                        }

                        let topvec = topface.concat(topface[0].clone());
                        let bottomvec = bottomface.concat(bottomface[0].clone());

                        // 侧边
                        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
                        vertices.push(...side[0]);
                        indices.push(...side[1]);
                        facevec.push(...side[2]);
                        count = side[3];

                        // 前后面
                        let shape = new Shape().setFromPoints(path);
                        // 挖孔
                        if (data.p_syfentype != 1 && holes && holes.length > 0) {
                            shape.holes.push(...holes);
                        }

                        let geometry = new ShapeGeometry(shape);
                        let positionAry = geometry.attributes.position;
                        let indexAry = geometry.getIndex();


                        // 顶点
                        let vertex: any[] = []
                        let index: any[] = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a, - b * sinB, b * cosB);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }


                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(topface);

                        count = Math.max(...indices) + 1;


                        // 顶点
                        vertex = []
                        index = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a, data.SXKH - b * sinB, b * cosB);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }

                        index.reverse();
                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(bottomface);

                        count = Math.max(...indices) + 1;

                    }
                    else if (data.p_xzxqtype === 4) {
                        cosB = W / WC;
                        sinB = data.XQNXJL / WC;
                        path = data.p_syfentype === 1 ? [
                            new Vector2(0, 0),
                            new Vector2(0, W / cosB),
                            new Vector2(H, W / cosB),
                            new Vector2(H, 0)
                        ] : [
                            new Vector2(0, 0),
                            new Vector2(0, W / cosB),
                            new Vector2(data.BKH, (W + lbv) / cosB),
                            new Vector2(data.BKH, data.BKH / cosB),
                            new Vector2((H + rbv), data.BKH / cosB),
                            new Vector2(H, 0)
                        ]

                        topface = [];
                        bottomface = [];
                        for (i = 0; i < path.length; i++) {

                            top = new Vector3(path[i].x, path[i].y * sinB, path[i].y * cosB);

                            bottom = new Vector3(path[i].x, data.SXKH + path[i].y * sinB, path[i].y * cosB);

                            topface.push(top);
                            bottomface.push(bottom);
                        }

                        let topvec = topface.concat(topface[0].clone());
                        let bottomvec = bottomface.concat(bottomface[0].clone());

                        // 侧边
                        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
                        vertices.push(...side[0]);
                        indices.push(...side[1]);
                        facevec.push(...side[2]);
                        count = side[3];

                        // 前后面
                        let shape = new Shape().setFromPoints(path);
                        // 挖孔
                        if (data.p_syfentype != 1 && holes && holes.length > 0) {
                            shape.holes.push(...holes);
                        }

                        let geometry = new ShapeGeometry(shape);
                        let positionAry = geometry.attributes.position;
                        let indexAry = geometry.getIndex();


                        // 顶点
                        let vertex: any[] = []
                        let index: any[] = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a, b * sinB, b * cosB);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }


                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(topface);

                        count = Math.max(...indices) + 1;


                        // 顶点
                        vertex = []
                        index = [];

                        for (let i = 0; i < positionAry.array.length; i += 3) {

                            let a = positionAry.array[i];
                            let b = positionAry.array[i + 1];
                            let c = positionAry.array[i + 2];

                            vertex.push(a, data.SXKH + b * sinB, b * cosB);
                        }

                        // 索引
                        for (let i = 0; i < indexAry.array.length; i += 3) {
                            let a = indexAry.array[i] + count;
                            let b = indexAry.array[i + 1] + count;
                            let c = indexAry.array[i + 2] + count;

                            index.push(a, b, c);
                        }

                        index.reverse();
                        vertices.push(...vertex);
                        indices.push(...index);
                        facevec.push(bottomface);

                        count = Math.max(...indices) + 1;
                    }
                    else {
                        if (data.p_xzfentype === 1) {
                            path = [
                                new Vector2(0, 0),
                                new Vector2(0, W),
                                new Vector2(H, W),
                                new Vector2(H, 0)
                            ]
                            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, data.SXKH, 0, false);
                        }
                        else {
                            path = [
                                new Vector2(0, 0),
                                new Vector2(0, W),
                                new Vector2(data.BKH, W + lbv),
                                new Vector2(data.BKH, data.BKH),
                                new Vector2((H + rbv), data.BKH),
                                new Vector2(H, 0)
                            ]

                            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, data.SXKH, 0, false);
                        }
                    }
                }
            }
        }

        // 易拆
        if (data.p_yctype === 2) {
            // 左切

            cosB = W / WC;
            sinB = data.XQNXJL / WC;
            path = [
                new Vector2(0, 0),
                new Vector2(0, W / cosB),
                new Vector2(data.BKH, (W + lbv) / cosB),
                new Vector2(data.BKH, data.BKH / cosB),
                new Vector2((H + rbv), data.BKH / cosB),
                new Vector2(H, 0)
            ];

            topface = [];
            bottomface = [];
            for (i = 0; i < path.length; i++) {

                top = new Vector3(path[i].x, L / 2 + path[i].y * sinB, path[i].y * cosB);

                bottom = new Vector3(path[i].x, L / 2 - data.SXKH + path[i].y * sinB, path[i].y * cosB);

                topface.push(top);
                bottomface.push(bottom);
            }

            let topvec = topface.concat(topface[0].clone());
            let bottomvec = bottomface.concat(bottomface[0].clone());

            // 侧边
            let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            topface = [];
            bottomface = [];
            for (i = 0; i < path.length; i++) {

                top = new Vector3(path[i].x, L / 2 + path[i].y * sinB, path[i].y * cosB);

                bottom = new Vector3(path[i].x, L / 2 + data.SXKH + path[i].y * sinB, path[i].y * cosB);

                topface.push(top);
                bottomface.push(bottom);
            }

            topvec = topface.concat(topface[0].clone());
            bottomvec = bottomface.concat(bottomface[0].clone());

            // 侧边
            side = MoldUtils.getSideVIF(topvec, bottomvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            // 前后面
            let shape = new Shape().setFromPoints(path);
            // 挖孔
            if (data.p_syfentype != 1 && holes && holes.length > 0) {
                shape.holes.push(...holes);
            }

            let geometry = new ShapeGeometry(shape);
            let positionAry = geometry.attributes.position;
            let indexAry = geometry.getIndex();


            // 顶点
            let vertex: any[] = []
            let index: any[] = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, L / 2 + b * sinB, b * cosB);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(topface);

            count = Math.max(...indices) + 1;


            // 顶点
            vertex = []
            index = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, L / 2 - data.SXKH + b * sinB, b * cosB);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }


            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(bottomface);

            count = Math.max(...indices) + 1;



            // 底下

            vertex = []
            index = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, L / 2 + data.SXKH + b * sinB, b * cosB);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(bottomface);

            count = Math.max(...indices) + 1;


        }
        else if (data.p_yctype === 1) {
            // 右切
            cosB = W / WC;
            sinB = data.XQNXJL / WC;
            path = data.p_syfentype === 1 ? [
                new Vector2(0, 0),
                new Vector2(0, W / cosB),
                new Vector2(H, W / cosB),
                new Vector2(H, 0)
            ] : [
                new Vector2(0, 0),
                new Vector2(0, W / cosB),
                new Vector2(data.BKH, (W + lbv) / cosB),
                new Vector2(data.BKH, data.BKH / cosB),
                new Vector2((H + rbv), data.BKH / cosB),
                new Vector2(H, 0)
            ]

            topface = [];
            bottomface = [];
            for (i = 0; i < path.length; i++) {

                top = new Vector3(path[i].x, L / 2 - path[i].y * sinB, path[i].y * cosB);

                bottom = new Vector3(path[i].x, L / 2 - data.SXKH - path[i].y * sinB, path[i].y * cosB);

                topface.push(top);
                bottomface.push(bottom);
            }

            let topvec = topface.concat(topface[0].clone());
            let bottomvec = bottomface.concat(bottomface[0].clone());

            // 侧边
            let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];


            topface = [];
            bottomface = [];
            for (i = 0; i < path.length; i++) {

                top = new Vector3(path[i].x, L / 2 - path[i].y * sinB, path[i].y * cosB);

                bottom = new Vector3(path[i].x, L / 2 + data.SXKH - path[i].y * sinB, path[i].y * cosB);

                topface.push(top);
                bottomface.push(bottom);
            }

            topvec = topface.concat(topface[0].clone());
            bottomvec = bottomface.concat(bottomface[0].clone());

            // 侧边
            side = MoldUtils.getSideVIF(topvec, bottomvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            // 前后面
            let shape = new Shape().setFromPoints(path);
            // 挖孔
            if (data.p_syfentype != 1 && holes && holes.length > 0) {
                shape.holes.push(...holes);
            }

            let geometry = new ShapeGeometry(shape);
            let positionAry = geometry.attributes.position;
            let indexAry = geometry.getIndex();


            // 顶点
            let vertex: any[] = []
            let index: any[] = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, L / 2 - b * sinB, b * cosB);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(topface);

            count = Math.max(...indices) + 1;


            // 顶点
            vertex = []
            index = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, L / 2 - data.SXKH - b * sinB, b * cosB);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }


            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(bottomface);

            count = Math.max(...indices) + 1;

            vertex = []
            index = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, L / 2 + data.SXKH - b * sinB, b * cosB);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(bottomface);

            count = Math.max(...indices) + 1;
        }

        // 横肋
        let hldw = AModelFmulaUtils.getHolesbyExpress(data.p_hldw, L, 2, data, AK.p_hldw);
        if (data.HLW && data.HLW > 0 && hldw && hldw.length > 0) {

            if (H === 50 && W != 50) {
                path = [
                    new Vector2(data.GMT, data.ZYKH),
                    new Vector2(data.GMT, W - data.ZYKH),
                    new Vector2(data.BKH, W - data.ZYKH + lbv),
                    new Vector2(data.BKH, data.ZYKH)
                ]
            }
            else if (W === 50 && H != 50) {
                path = [
                    new Vector2(data.ZYKH, data.GMT),
                    new Vector2(data.ZYKH, data.BKH),
                    new Vector2(H - data.ZYKH + rbv, data.BKH),
                    new Vector2(H - data.ZYKH, data.GMT)
                ]
            }
            else {
                path = [
                    new Vector2(data.GMT, data.GMT),
                    new Vector2(data.GMT, W - data.ZYKH),
                    new Vector2(data.BKH, W - data.ZYKH + lbv),
                    new Vector2(data.BKH, data.BKH),
                    new Vector2(H - data.ZYKH + rbv, data.BKH),
                    new Vector2(H - data.ZYKH, data.GMT)
                ]
            }

            for (let i = 0; i < hldw.length; i++) {
                count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null,
                    2, hldw[i] + data.HLW / 2, hldw[i] - data.HLW / 2, false);
            }
        }
        return [vertices, indices, facevec];
    }

    /**
     * 获取 夹角形状的坐标 \__
     * @param fh 
     * @param sh 
     * @param zyl 
     * @param yyl 
     * @param sinA 
     * @param cosA 
     * @returns 
     */
    static getCornerPath(fh: number, yh: number, zh: number, zyl: number, yyl: number, sinA: number, cosA: number, fu: boolean = false) {
        let path = fu ? [
            new Vector2(fh / sinA + fh / sinA * cosA, -fh),
            new Vector2(fh * sinA + zyl * cosA, -zyl * sinA + fh * cosA),

            new Vector2(zh * sinA + zyl * cosA, -zyl * sinA + zh * cosA),
            new Vector2(zh / sinA + yh / sinA * cosA, -yh),

            new Vector2(yyl, -yh),
            new Vector2(yyl, -fh)
        ] : [
            new Vector2(fh / sinA + fh / sinA * cosA, fh),
            new Vector2(fh * sinA + zyl * cosA, zyl * sinA - fh * cosA),

            new Vector2(zh * sinA + zyl * cosA, zyl * sinA - zh * cosA),
            new Vector2(zh / sinA + yh / sinA * cosA, yh),

            new Vector2(yyl, yh),
            new Vector2(yyl, fh)
        ]

        return path;
    }

    /**
     * 根据路径和洞，获取带孔的面数据
     * @param count 
     * @param vertices 
     * @param indices 
     * @param facevec 
     * @param path 
     * @param holes 
     * @param face 
     * @param isreverse 
     * @returns 
     */
    static getHolePathFace(count: number, vertices: any[], indices: any[], facevec: any[], path: Vector2[], holes: Path[], face: Vector3[],
        cosA: number, sinA: number, ZYW: number, YYW: number, zv: number, type: number = 0, isreverse: boolean = false): number {
        let shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let vertex: any[] = []
        let index: any[] = [];

        let geometry = new ShapeGeometry(shape);
        let positionAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            type === 1 ? vertex.push(a * cosA + ZYW / sinA + YYW / sinA * cosA, b, a * sinA + YYW) :
                type === 2 ? vertex.push(a * cosA + ZYW / sinA + YYW / sinA * cosA, b, a * sinA + YYW) :
                    vertex.push(a, b, zv);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        !isreverse ? index.reverse() : null;
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(face.concat());

        count = Math.max(...indices) + 1;
        geometry.dispose();

        return count;
    }

    /**
     * 获取右背面
     * @param count 
     * @param vertices 
     * @param indices 
     * @param facevec 
     * @param holes 
     * @param bx 
     * @param tx 
     * @param maxx 
     * @param miny 
     * @param maxy 
     * @param minz 
     * @param maxz 
     * @returns 
     */
    static getRightHoleVI(count: number, vertices: any[], indices: any[], facevec: any[], holes: Path[],
        bx: number, tx: number, bmaxx: number, tmaxx: number, miny: number, maxy: number, minz: number, maxz: number,
        cosA: number, sinA: number, ZYW: number, YYW: number, leftxie: number = 0): number {

        // 后
        let backpath = [
            new Vector2(bx, maxy),
            new Vector2(bx, miny),
            new Vector2(bmaxx + leftxie, miny),
            new Vector2(bmaxx, maxy)
        ]

        let backface = [
            new Vector3(bx, maxy, minz),
            new Vector3(bx, miny, minz),
            new Vector3(bmaxx + leftxie, miny, minz),
            new Vector3(bmaxx, maxy, minz)
        ]

        //前 
        let fontpath = [
            new Vector2(tx, maxy),
            new Vector2(tx, miny),
            new Vector2(tmaxx + leftxie, miny),
            new Vector2(tmaxx, maxy)
        ];

        let frontface = [
            new Vector3(tx, maxy, maxz),
            new Vector3(tx, miny, maxz),
            new Vector3(tmaxx + leftxie, miny, maxz),
            new Vector3(tmaxx, maxy, maxz)
        ]

        count = MoldUtils.getHolePathFace(count, vertices, indices, facevec, backpath, holes, backface, cosA, sinA, ZYW, YYW, minz, 0);
        count = MoldUtils.getHolePathFace(count, vertices, indices, facevec, fontpath, holes, frontface, cosA, sinA, ZYW, YYW, maxz, 0, true);

        // 封边
        // 顶点
        vertices.push(backface[3].x, backface[3].y, backface[3].z);
        vertices.push(backface[2].x, backface[2].y, backface[2].z);

        vertices.push(frontface[3].x, frontface[3].y, frontface[3].z);
        vertices.push(frontface[2].x, frontface[2].y, frontface[2].z);

        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        // 下
        vertices.push(backface[2].x, backface[2].y, backface[2].z);
        vertices.push(backface[1].x, backface[1].y, backface[1].z);

        vertices.push(frontface[2].x, frontface[2].y, frontface[2].z);
        vertices.push(frontface[1].x, frontface[1].y, frontface[1].z);

        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        vertices.push(backface[0].x, backface[0].y, backface[0].z);
        vertices.push(backface[3].x, backface[3].y, backface[3].z);

        vertices.push(frontface[0].x, frontface[0].y, frontface[0].z);
        vertices.push(frontface[3].x, frontface[3].y, frontface[3].z);

        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        return count;
    }

    /**
     * 带孔的左斜板
     * @param count 
     * @param vertices 
     * @param indices 
     * @param facevec 
     * @param holes 
     * @param backpath 
     * @param fontpath 
     * @param backface 
     * @param frontface 
     * @param ZYW 左宽
     * @param YYW 右宽
     * @param BKH 厚度
     * @param sinA 
     * @param cosA 
     * @returns 
     */
    static getLeftHoleVI(count: number, vertices: any[], indices: any[], facevec: any[], bholes: Path[], fholes: Path[],
        backpath: Vector2[], fontpath: Vector2[], backface: Vector3[], frontface: Vector3[],
        ZYW: number, YYW: number, BKH: number, sinA: number, cosA: number): number {

        // 后
        count = MoldUtils.getHolePathFace(count, vertices, indices, facevec, backpath, bholes, backface, cosA, sinA, ZYW - BKH, YYW - BKH, 0, 1, true);
        count = MoldUtils.getHolePathFace(count, vertices, indices, facevec, fontpath, fholes, frontface, cosA, sinA, ZYW, YYW, 0, 2, false);

        // 封边
        // 顶点
        vertices.push(backface[2].x, backface[2].y, backface[2].z);
        vertices.push(backface[3].x, backface[3].y, backface[3].z);

        vertices.push(frontface[2].x, frontface[2].y, frontface[2].z);
        vertices.push(frontface[3].x, frontface[3].y, frontface[3].z);
        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        // 底边
        vertices.push(backface[1].x, backface[1].y, backface[1].z);
        vertices.push(backface[2].x, backface[2].y, backface[2].z);

        vertices.push(frontface[1].x, frontface[1].y, frontface[1].z);
        vertices.push(frontface[2].x, frontface[2].y, frontface[2].z);
        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;
        // 顶边
        vertices.push(backface[3].x, backface[3].y, backface[3].z);
        vertices.push(backface[0].x, backface[0].y, backface[0].z);

        vertices.push(frontface[3].x, frontface[3].y, frontface[3].z);
        vertices.push(frontface[0].x, frontface[0].y, frontface[0].z);
        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        return count;
    }

    /**
     * 获取左斜的距离
     * @param zh 左宽
     * @param yh 右宽
     * @param sinA 
     * @param cosA 
     * @returns 
     */
    static getLeftXieVi(zh: number, yh: number, zyl: number, sinA: number, cosA: number): any[] {

        let p1 = new Vector2(zh / sinA + yh / sinA * cosA, yh);
        let p2 = new Vector2(zh * sinA + zyl * cosA, zyl * sinA - zh * cosA);
        let dis = p1.distanceTo(p2);
        return [p1, p2, dis];
    }

    static getLeftXieFaceVI(zh: number, yh: number, zyl: number, miny: number, maxy: number, sinA: number, cosA: number, xie: number = 0) {
        return [
            new Vector3(zh / sinA + yh / sinA * cosA, maxy, yh),
            new Vector3(zh / sinA + yh / sinA * cosA, miny, yh),
            new Vector3(zh * sinA + (zyl + xie) * cosA, miny, (zyl + xie) * sinA - zh * cosA),
            new Vector3(zh * sinA + zyl * cosA, maxy, zyl * sinA - zh * cosA)
        ]
    }

    static inPolygon(point: Vector2, polygon: Vector2[], r: number): boolean {

        let i: number, dis: number;
        let cross: Vector2[] = [];
        let vec = polygon.concat(polygon[0])
        for (i = 0; i < vec.length; i++) {
            // 相交
            dis = vec[i].distanceTo(point);
            if (dis < r) {
                return false;
            }
        }
        return true;
    }


    static getSlotCornerBottomFaceHoles(data: ALParams, ZYL: number, YYL: number, leftQie: number, rightQie: number, minRX: number, cosA: number, sinA: number, holes: Path[]) {
        // 左翼下框平孔
        let zyxbkk = AModelFmulaUtils.getHolesbyExpress(data.p_zyxkpk, ZYL + leftQie, 2, data, AK.p_zyxkpk);
        // let filterNum = 0;
        let i: number, xv: number, yv: number;
        let holePath: Path;
        for (i = 0; i < zyxbkk.length; i++) {
            xv = zyxbkk[i] * cosA + data.BKKJMDis * sinA;
            yv = zyxbkk[i] * sinA - data.BKKJMDis * cosA;
            // 过滤孔
            if (zyxbkk[i] < minRX + data.BKDia / 2) {
                // filterNum++;
                continue;
            }
            if (zyxbkk[i] > ZYL + leftQie - data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // AModelFmulaUtils.getHolesbyExpress(data.p_zyxkpk, ZYL + leftQie, 2, data, AK.p_zyxkpk, filterNum);

        // 右翼下框平孔
        let yyxbkk = AModelFmulaUtils.getHolesbyExpress(data.p_yyxkpk, YYL + rightQie, 2, data, AK.p_yyxkpk);
        // filterNum = 0;
        for (i = 0; i < yyxbkk.length; i++) {
            xv = yyxbkk[i];
            yv = data.BKKJMDis;

            // 过滤孔
            if (xv < minRX + data.BKDia / 2) {
                // filterNum++;
                continue;
            }
            if (xv > YYL + rightQie - data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // AModelFmulaUtils.getHolesbyExpress(data.p_yyxkpk, YYL + rightQie, 2, data, AK.p_yyxkpk, filterNum);
    }

    static getSlotCornerTopFaceHoles(data: ALParams, ZYL: number, YYL: number, ZYW: number, YYW: number, tanC: number, cosA: number, sinA: number, holes: Path[]) {

        let zysk1 = AModelFmulaUtils.getHolesbyExpress(data.p_zysk, ZYL, 2, data, AK.p_zysk);
        let yysk1 = AModelFmulaUtils.getHolesbyExpress(data.p_yysk, YYL, 2, data, AK.p_yysk);

        let minxx = (data.BKH + ZYW) / tanC;
        let i: number, xv: number, yv: number;
        let holePath: Path;
        // let filterNum = 0;

        for (i = 0; i < zysk1.length; i++) {
            xv = zysk1[i] * cosA + (data.BKKJMDis + ZYW) * sinA;
            yv = zysk1[i] * sinA - (data.BKKJMDis + ZYW) * cosA;
            // 过滤孔
            if (zysk1[i] < minxx + data.BKDia / 2) {
                // filterNum++;
                continue;
            }

            if (zysk1[i] > ZYL - data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // AModelFmulaUtils.getHolesbyExpress(data.p_zysk, ZYL, 2, data, AK.p_zysk, filterNum);

        // filterNum = 0;
        for (i = 0; i < yysk1.length; i++) {
            xv = yysk1[i];
            yv = data.BKKJMDis + YYW;

            // 过滤孔
            if (xv < minxx + data.BKDia / 2) {
                // filterNum++;
                continue;
            }
            if (xv > YYL - data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // AModelFmulaUtils.getHolesbyExpress(data.p_yysk, YYL, 2, data, AK.p_yysk, filterNum);
    }

    /**
     * 转角 C 槽
     * @param data 
     * @returns 
     */
    static getSlotCornerVI(data: ALParams, outer: boolean): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;
        let angle = (data.p_jiajiao !== 0 && data.p_jiajiao % 180 === 0) ? data.p_jiajiao - 0.001 : data.p_jiajiao;

        let actualAg = outer ? (360 - angle) : angle;
        let radian = outer ? (360 - angle) / 180 * Math.PI : angle / 180 * Math.PI;
        let cosA = Math.cos(radian);
        let sinA = Math.sin(radian);

        let radianBan = data.p_jiajiao / 2 / 180 * Math.PI;
        let tanC = Math.tan(radianBan);
        let minRX = actualAg > 180 ? -data.BKH / Math.abs(tanC) : data.BKH / Math.abs(tanC);

        // 基础数据
        let ZYL = Number(data.zyL);
        let ZYW = Number(data.zyW);
        let YYL = Number(data.yyL);
        let YYW = Number(data.yyW);
        let H = Number(data.H);
        let XQNXJL = Number(data.XQNXJL);

        if (ZYL <= YYW) {
            ZYL = YYW + 0.01;
            data.zyL = YYW;
        }
        if (YYL <= ZYW) {
            YYL = ZYW + 0.01
            data.yyL = ZYW;
        }

        // let filterNum: number = 0;
        let tpath = MoldUtils.getCornerPath(0, YYW, ZYW, ZYL, YYL, sinA, cosA);
        let zx = tpath[1];
        let yp = tpath[5];
        let mid = tpath[3];
        let zx2 = tpath[2].add(zx).multiplyScalar(0.5);
        let ztpath = MoldUtils.getCornerPath(0, YYW / 2, ZYW / 2, ZYL, YYL, sinA, cosA);
        let ztp = ztpath[3];

        data.duan = [
            0, 0, 0,
            zx.x, 0, zx.y,
            yp.x, 0, yp.y,
            0, -H, 0,
            zx.x, -H, zx.y,
            yp.x, -H, yp.y,
            mid.x, 0, mid.y
        ]

        data.zhong = {
            zyL: [
                {
                    pointer: [zx.x, -H / 2, zx.y],
                    center: [zx.x / 2, -H / 2, zx.y / 2],
                    dir: [zx.x, 0, zx.y]
                },
                {
                    pointer: [zx2.x, 0, zx2.y],
                    center: [ztp.x, 0, ztp.y],
                    dir: [zx.x, 0, zx.y]
                }
            ],
            yyL: [
                {
                    pointer: [YYL, 0, YYW / 2],
                    center: [YYL / 2, 0, YYW / 2],
                    dir: [YYL, 0, 0]
                },
                {
                    pointer: [YYL, -H / 2, 0],
                    center: [YYL / 2, -H / 2, 0],
                    dir: [YYL, 0, 0]
                }
            ]
        }


        let kongpoint = [];
        let kx: number, ky: number, kz: number;

        let path: Vector2[];
        let holes: Path[], bholes: Path[], fholes: Path[];
        let holePath: Path;

        let xv: number, yv: number, i: number;
        let backface: Vector3[], frontface: Vector3[];
        let backpath: Vector2[], fontpath: Vector2[];
        let fontp: any[], backp: any[];

        let iszywequal = ZYW === 50 && YYW === 50;
        // 垂直斜切
        let leftXie = (H === 50 || iszywequal) ? 0 : data.p_zyxqtype === 3 ? XQNXJL : data.p_zyxqtype === 4 ? -XQNXJL : 0;
        let rightXie = (H === 50 || iszywequal) ? 0 : data.p_yyxqtype === 3 ? XQNXJL : data.p_yyxqtype === 4 ? -XQNXJL : 0;
        // 水平斜切
        let leftQie = (H === 50 || iszywequal) ? 0 : data.p_zyxqtype === 1 ? XQNXJL : data.p_zyxqtype === 2 ? -XQNXJL : 0;
        let rightQie = (H === 50 || iszywequal) ? 0 : data.p_yyxqtype === 1 ? XQNXJL : data.p_yyxqtype === 2 ? -XQNXJL : 0;

        // 顶面
        let szyw = iszywequal ? data.BKH + ZYW : ZYW;
        let syyw = iszywequal ? data.BKH + YYW : YYW;

        path = MoldUtils.getCornerPath(0, syyw, szyw, ZYL, YYL, sinA, cosA);
        path[2].x += leftXie * cosA;
        path[2].y += leftXie * sinA;

        path[4].x += rightXie;

        holes = [];
        MoldUtils.getGmtHoles(data.p_r1, data.p_r1dw, holes, 2);
        MoldUtils.getGmtHoles(data.p_r2, data.p_r2dw, holes, 2);
        MoldUtils.getGmtHoles(data.p_r3, data.p_r3dw, holes, 2);

        if (iszywequal) {
            MoldUtils.getSlotCornerTopFaceHoles(data, ZYL, YYL, ZYW, YYW, tanC, cosA, sinA, holes);
        }

        let bpath = MoldUtils.getCornerPath(0, syyw, szyw, ZYL + (data.GMT / H) * leftQie, YYL + (data.GMT / H) * rightQie, sinA, cosA);

        bpath[2].x += leftXie * cosA;
        bpath[2].y += leftXie * sinA;

        bpath[4].x += rightXie;

        backface = [];
        frontface = [];
        for (i = 0; i < path.length; i++) {
            backface.push(new Vector3(bpath[i].x, -data.GMT, bpath[i].y))
            frontface.push(new Vector3(path[i].x, 0, path[i].y))
        }

        let topvec = backface.concat(backface[0].clone());
        let bottomvec = frontface.concat(frontface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 形状
        let shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            let tmpholes = MoldUtils.getHoleByDivisions(holes);
            shape.holes.push(...tmpholes);
        }

        let geometry = new ShapeGeometry(shape);
        let positionAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();

        // 顶点
        let vertex: any[] = []
        let index: any[] = [];

        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            vertex.push(a, 0, b);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(frontface.concat());

        count = Math.max(...indices) + 1;

        shape = new Shape().setFromPoints(bpath);
        // 挖孔
        if (holes && holes.length > 0) {
            let tmpholes = MoldUtils.getHoleByDivisions(holes);
            shape.holes.push(...tmpholes);
        }

        geometry.dispose();

        geometry = new ShapeGeometry(shape);
        positionAry = geometry.attributes.position;
        indexAry = geometry.getIndex();

        vertex = [];
        index = [];
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];

            vertex.push(a, -data.GMT, b);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(backface.concat());

        count = Math.max(...indices) + 1;
        geometry.dispose();

        // 底面
        if (H !== 50) {
            path = MoldUtils.getCornerPath(0, data.BKH, data.BKH, ZYL + leftQie, YYL + rightQie, sinA, cosA);

            path[2].x += data.BKH / ZYW * leftXie * cosA;
            path[2].y += data.BKH / ZYW * leftXie * sinA;

            path[4].x += data.BKH / YYW * rightXie;

            holes = [];



            bpath = MoldUtils.getCornerPath(0, data.BKH, data.BKH, ZYL + (H - data.ZYYJXKH) / H * leftQie, YYL + (H - data.ZYYJXKH) / H * rightQie, sinA, cosA);
            bpath[2].x += data.BKH / ZYW * leftXie * cosA;
            bpath[2].y += data.BKH / ZYW * leftXie * sinA;

            bpath[4].x += data.BKH / YYW * rightXie;

            backface = [];
            frontface = [];
            for (i = 0; i < path.length; i++) {
                backface.push(new Vector3(bpath[i].x, -H + data.ZYYJXKH, bpath[i].y))
                frontface.push(new Vector3(path[i].x, -H, path[i].y))
            }

            topvec = backface.concat(backface[0].clone());
            bottomvec = frontface.concat(frontface[0].clone());

            // 侧边
            side = MoldUtils.getSideVIF(bottomvec, topvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            // 形状
            shape = new Shape().setFromPoints(path);
            // 挖孔
            if (holes && holes.length > 0) {
                let tmpholes = MoldUtils.getHoleByDivisions(holes);
                shape.holes.push(...tmpholes);
            }

            geometry = new ShapeGeometry(shape);
            positionAry = geometry.attributes.position;
            indexAry = geometry.getIndex();

            // 顶点
            vertex = []
            index = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, -H, b);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(frontface.concat());

            count = Math.max(...indices) + 1;
            geometry.dispose();


            shape = new Shape().setFromPoints(bpath);
            // 挖孔
            if (holes && holes.length > 0) {
                let tmpholes = MoldUtils.getHoleByDivisions(holes);
                shape.holes.push(...tmpholes);
            }

            geometry = new ShapeGeometry(shape);
            positionAry = geometry.attributes.position;
            indexAry = geometry.getIndex();

            vertex = [];
            index = [];
            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a, -H + data.ZYYJXKH, b);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(backface.concat());

            count = Math.max(...indices) + 1;
            geometry.dispose();

        }


        // 转角点
        let xx: number = data.ZYYFBH / sinA + data.ZYYFBH / sinA * cosA;

        // 左侧面孔
        let zch = H === 50 ? data.BKH + H : H;


        fontp = MoldUtils.getLeftXieVi(0, 0, ZYL, sinA, cosA);
        backp = MoldUtils.getLeftXieVi(data.ZYYFBH, data.ZYYFBH, ZYL + data.ZYYFBH / ZYW * leftXie, sinA, cosA);

        fholes = [];
        MoldUtils.getGmtHoles(data.p_l_r1, data.p_l_r1dw, fholes, 1);
        MoldUtils.getGmtHoles(data.p_l_r2, data.p_l_r2dw, fholes, 1);
        MoldUtils.getGmtHoles(data.p_l_r3, data.p_l_r3dw, fholes, 1);

        bholes = [];
        MoldUtils.getGmtHoles(data.p_l_r1, data.p_l_r1dw, bholes, 1, false, backp[2] - fontp[2]);
        MoldUtils.getGmtHoles(data.p_l_r2, data.p_l_r2dw, bholes, 1, false, backp[2] - fontp[2]);
        MoldUtils.getGmtHoles(data.p_l_r3, data.p_l_r3dw, bholes, 1, false, backp[2] - fontp[2]);


        fontpath = [
            new Vector2(0, 0),
            new Vector2(fontp[2], 0),
            new Vector2(fontp[2] + leftQie, -zch),
            new Vector2(0, -zch)
        ]
        frontface = MoldUtils.getLeftXieFaceVI(0, 0, ZYL, -zch, 0, sinA, cosA, leftQie);

        backpath = [
            new Vector2(0, 0),
            new Vector2(backp[2], 0),
            new Vector2(backp[2] + leftQie, -zch),
            new Vector2(0, -zch)
        ]
        backface = MoldUtils.getLeftXieFaceVI(data.ZYYFBH, data.ZYYFBH, ZYL + data.ZYYFBH / ZYW * leftXie, -zch, 0, sinA, cosA, leftQie);

        if (H === 50) {

            fholes = [];
            kongpoint = [];
            // 左翼下框平孔
            let zyxkpk50 = AModelFmulaUtils.getHolesbyExpress(data.p_zyxkpk, ZYL, 2, data, AK.p_zyxkpk);

            for (i = 0; i < zyxkpk50.length; i++) {
                xv = zyxkpk50[i];
                yv = -(data.BKH - data.BKKJMDis) - H;

                // 过滤孔
                if (zyxkpk50[i] > ZYL - data.BKDia / 2) {

                    continue;
                }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                fholes.push(holePath);

                kongpoint.push(xv, yv, 0);
            }
            // AModelFmulaUtils.getHolesbyExpress(data.p_zyxkpk, ZYL, 2, data, AK.p_zyxkpk, filterNum);
            bholes = [];
            for (i = 0; i < zyxkpk50.length; i++) {
                xv = zyxkpk50[i] + backp[2] - fontp[2];
                yv = -(data.BKH - data.BKKJMDis) - H;

                // if (zysk[i] > backp[2] - data.BKDia / 2) {
                //     continue;
                // }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                bholes.push(holePath);

            }




            count = MoldUtils.getLeftHoleVI(count, vertices, indices, facevec, fholes, bholes, fontpath, backpath, frontface, backface, data.ZYYFBH, data.ZYYFBH, data.ZYYFBH, sinA, cosA);
        }
        else {

            count = MoldUtils.getLeftHoleVI(count, vertices, indices, facevec, fholes, bholes, fontpath, backpath, frontface, backface, data.ZYYFBH, data.ZYYFBH, data.ZYYFBH, sinA, cosA);
        }


        // 右侧面孔
        let ych = H === 50 ? data.BKH + H : H;

        holes = [];
        MoldUtils.getGmtHoles(data.p_r_r1, data.p_r_r1dw, holes, 2);
        MoldUtils.getGmtHoles(data.p_r_r2, data.p_r_r2dw, holes, 2);
        MoldUtils.getGmtHoles(data.p_r_r3, data.p_r_r3dw, holes, 2);

        backpath = [
            new Vector2(0, 0),
            new Vector2(0, -ych),
            new Vector2(YYL + rightQie, -ych),
            new Vector2(YYL, 0)
        ]

        backface = [
            new Vector3(0, 0, 0),
            new Vector3(0, -ych, 0),
            new Vector3(YYL + rightQie, -ych, 0),
            new Vector3(YYL, 0, 0)
        ]

        fontpath = [
            new Vector2(xx, 0),
            new Vector2(xx, -ych),
            new Vector2(YYL + rightQie + data.ZYYFBH / YYW * rightXie, -ych),
            new Vector2(YYL + + data.ZYYFBH / YYW * rightXie, 0)
        ]

        frontface = [
            new Vector3(xx, 0, data.ZYYFBH),
            new Vector3(xx, -ych, data.ZYYFBH),
            new Vector3(YYL + rightQie + data.ZYYFBH / YYW * rightXie, -ych, data.ZYYFBH),
            new Vector3(YYL + data.ZYYFBH / YYW * rightXie, 0, data.ZYYFBH)
        ]

        if (H === 50) {
            holes = [];
            kongpoint = [];
            let yyxkpk50 = AModelFmulaUtils.getHolesbyExpress(data.p_yyxkpk, YYL, 2, data, AK.p_yyxkpk);
            // filterNum = 0;
            for (i = 0; i < yyxkpk50.length; i++) {
                xv = yyxkpk50[i];
                yv = -(data.BKH - data.BKKJMDis) - H;

                // 过滤孔
                if (yv > YYL - data.BKDia / 2) {
                    // filterNum++;
                    continue;
                }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);

                kongpoint.push(xv, yv, 0);
            }


            // AModelFmulaUtils.getHolesbyExpress(data.p_yyxkpk, YYL, 2, data, AK.p_yyxkpk, filterNum);
        }

        count = MoldUtils.getHolePathFace(count, vertices, indices, facevec, backpath, holes, backface, cosA, sinA, ZYW, YYW, 0, 0);
        count = MoldUtils.getHolePathFace(count, vertices, indices, facevec, fontpath, holes, frontface, cosA, sinA, ZYW, YYW, data.ZYYFBH, 0, true);

        // 封边
        // 顶点
        vertices.push(backface[3].x, backface[3].y, backface[3].z);
        vertices.push(backface[2].x, backface[2].y, backface[2].z);

        vertices.push(frontface[3].x, frontface[3].y, frontface[3].z);
        vertices.push(frontface[2].x, frontface[2].y, frontface[2].z);

        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        // 下
        vertices.push(backface[2].x, backface[2].y, backface[2].z);
        vertices.push(backface[1].x, backface[1].y, backface[1].z);

        vertices.push(frontface[2].x, frontface[2].y, frontface[2].z);
        vertices.push(frontface[1].x, frontface[1].y, frontface[1].z);

        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        vertices.push(backface[0].x, backface[0].y, backface[0].z);
        vertices.push(backface[3].x, backface[3].y, backface[3].z);

        vertices.push(frontface[0].x, frontface[0].y, frontface[0].z);
        vertices.push(frontface[3].x, frontface[3].y, frontface[3].z);

        // 索引
        indices.push(count, count + 2, count + 1);
        indices.push(count + 2, count + 3, count + 1);

        count += 4;

        // 左翼竖孔
        if (!iszywequal) {

            fontp = MoldUtils.getLeftXieVi(ZYW - data.ZYYJXKH, YYW - data.ZYYJXKH, ZYL + (ZYW - data.ZYYJXKH) / ZYW * leftXie, sinA, cosA);
            backp = MoldUtils.getLeftXieVi(ZYW, YYW, ZYL + leftXie, sinA, cosA);

            backpath = [
                new Vector2(0, 0),
                new Vector2(backp[2], 0),
                new Vector2(backp[2] + data.BKH / H * leftQie, -data.BKH),
                new Vector2(0, -data.BKH)
            ]

            backface = MoldUtils.getLeftXieFaceVI(ZYW - data.ZYYJXKH, YYW - data.ZYYJXKH, ZYL + (ZYW - data.ZYYJXKH) / ZYW * leftXie, -data.BKH, 0, sinA, cosA, data.BKH / H * leftQie);

            fontpath = [
                new Vector2(0, 0),
                new Vector2(fontp[2], 0),
                new Vector2(fontp[2] + data.BKH / H * leftQie, -data.BKH),
                new Vector2(0, -data.BKH)
            ]
            frontface = MoldUtils.getLeftXieFaceVI(ZYW, YYW, ZYL + leftXie, -data.BKH, 0, sinA, cosA, data.BKH / H * leftQie);

            bholes = [];
            kongpoint = [];

            let zysk = AModelFmulaUtils.getHolesbyExpress(data.p_zysk, backp[2], 2, data, AK.p_zysk);
            // filterNum = 0;
            for (i = 0; i < zysk.length; i++) {
                xv = zysk[i];
                yv = -(data.BKH - data.BKKJMDis);

                // if (xv > fontp[2] - data.BKDia / 2) {
                //     // filterNum++;
                //     continue;
                // }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                bholes.push(holePath);

                kongpoint.push(xv, yv, 0);
            }

            fholes = [];
            for (i = 0; i < zysk.length; i++) {
                xv = zysk[i] - backp[2] + fontp[2];
                yv = -(data.BKH - data.BKKJMDis);

                // if (zysk[i] > backp[2] - data.BKDia / 2) {
                //     continue;
                // }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                fholes.push(holePath);

            }

            // AModelFmulaUtils.getHolesbyExpress(data.p_zysk, ZYL + leftXie + leftQie, 2, data, AK.p_zysk, filterNum);



            count = MoldUtils.getLeftHoleVI(count, vertices, indices, facevec, fholes, bholes, fontpath, backpath, backface,
                frontface, ZYW, YYW, data.ZYYJXKH, sinA, cosA);

            // 右翼竖孔
            let bx = (ZYW - data.ZYYJXKH) / sinA + (YYW - data.ZYYJXKH) / sinA * cosA;
            let tx = ZYW / sinA + YYW / sinA * cosA;

            holes = [];
            kongpoint = [];
            let yysk = AModelFmulaUtils.getHolesbyExpress(data.p_yysk, YYL - tx + rightXie, 2, data, AK.p_yysk);
            // filterNum = 0;
            for (i = 0; i < yysk.length; i++) {
                xv = yysk[i] + tx;
                yv = -(data.BKH - data.BKKJMDis)

                // if (xv < tx + data.BKDia / 2) {
                //     // filterNum++;
                //     continue;
                // }
                // if (xv > YYL + rightXie + (data.BKH - data.BKKJMDis) / H * rightQie - data.BKDia / 2) {
                //     continue;
                // }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
                kongpoint.push(xv, yv, 0);
            }
            // AModelFmulaUtils.getHolesbyExpress(data.p_yysk, YYL + rightXie, 2, data, AK.p_yysk, filterNum);


            count = MoldUtils.getRightHoleVI(count, vertices, indices, facevec, holes, bx, tx, YYL + (ZYW - data.ZYYJXKH) / ZYW * rightXie,
                YYL + rightXie, -data.BKH, 0, YYW - data.ZYYJXKH, YYW, cosA, sinA, ZYW, YYW, data.BKH / H * rightQie);
        }

        // 左封
        if (data.p_zfentype != 2) {

            if (data.p_zfentype === 1) {

                let mfh = H === 50 ? data.BKH + H : H;
                let mfw = iszywequal ? data.BKH + ZYW : ZYW;
                path = [
                    new Vector2(0, 0),
                    new Vector2(0, -mfh),
                    new Vector2(mfw, -mfh),
                    new Vector2(mfw, 0)
                ];

                backface = [
                    new Vector3(ZYL * cosA, 0, ZYL * sinA),
                    new Vector3((ZYL + leftQie) * cosA, -mfh, (ZYL + leftQie) * sinA),

                    new Vector3((ZYL + leftXie + leftQie) * cosA + mfw * sinA, -mfh, (ZYL + leftXie + leftQie) * sinA - mfw * cosA),
                    new Vector3((ZYL + leftXie) * cosA + mfw * sinA, 0, (ZYL + leftXie) * sinA - mfw * cosA)
                ];
                frontface = [
                    new Vector3((ZYL - data.ZYYFBH) * cosA, 0, (ZYL - data.ZYYFBH) * sinA),
                    new Vector3((ZYL - data.ZYYFBH + leftQie) * cosA, -mfh, (ZYL - data.ZYYFBH + leftQie) * sinA),

                    new Vector3((ZYL - data.ZYYFBH + leftXie + leftQie) * cosA + mfw * sinA, -mfh, (ZYL - data.ZYYFBH + leftXie + leftQie) * sinA - mfw * cosA),
                    new Vector3((ZYL - data.ZYYFBH + leftXie) * cosA + mfw * sinA, 0, (ZYL - data.ZYYFBH + leftXie) * sinA - mfw * cosA)
                ];

                holes = [];
                // count = MoldUtils.getFengVI(count, vertices, indices, facevec, ZYL, data.ZYYJXKH, cosA, sinA, backface, frontface, path, null);
            }
            else {
                path = H === 50 ? [
                    new Vector2(0, 0),
                    new Vector2(0, -data.BKH),
                    new Vector2(ZYW, -data.BKH),
                    new Vector2(ZYW, 0)
                ] : iszywequal ? [
                    new Vector2(0, 0),
                    new Vector2(0, -H),
                    new Vector2(data.BKH, -H),
                    new Vector2(data.BKH, 0)
                ] : [
                    new Vector2(0, 0),
                    new Vector2(0, -H),
                    new Vector2(data.BKH, -H),
                    new Vector2(data.BKH, -data.BKH),
                    new Vector2(ZYW, -data.BKH),
                    new Vector2(ZYW, 0)
                ];

                backface = H === 50 ? [
                    new Vector3(ZYL * cosA, 0, ZYL * sinA),
                    new Vector3((ZYL + leftQie) * cosA, -data.BKH, (ZYL + leftQie) * sinA),
                    new Vector3((ZYL + leftXie + data.BKH / H * leftQie) * cosA + ZYW * sinA, -data.BKH, (ZYL + leftXie + data.BKH / H * leftQie) * sinA - ZYW * cosA),
                    new Vector3((ZYL + leftXie) * cosA + ZYW * sinA, 0, (ZYL + leftXie) * sinA - ZYW * cosA)
                ] : iszywequal ? [
                    new Vector3(ZYL * cosA, 0, ZYL * sinA),
                    new Vector3((ZYL + leftQie) * cosA, -H, (ZYL + leftQie) * sinA),
                    new Vector3((ZYL + leftXie + data.BKH / H * leftQie) * cosA + (data.BKH) * sinA, -H, (ZYL + leftXie + data.BKH / H * leftQie) * sinA - (data.BKH) * cosA),
                    new Vector3((ZYL + leftXie) * cosA + (data.BKH) * sinA, 0, (ZYL + leftXie) * sinA - (data.BKH) * cosA)
                ] : [
                    new Vector3(ZYL * cosA, 0, ZYL * sinA),
                    new Vector3((ZYL + leftQie) * cosA, -H, (ZYL + leftQie) * sinA),
                    new Vector3((ZYL + data.BKH / ZYW * leftXie + leftQie) * cosA + data.BKH * sinA, -H, (ZYL + data.BKH / ZYW * leftXie + leftQie) * sinA - data.BKH * cosA),
                    new Vector3((ZYL + data.BKH / ZYW * leftXie + data.BKH / H * leftQie) * cosA + data.BKH * sinA, -data.BKH, (ZYL + data.BKH / ZYW * leftXie + data.BKH / H * leftQie) * sinA - data.BKH * cosA),
                    new Vector3((ZYL + leftXie + data.BKH / H * leftQie) * cosA + ZYW * sinA, -data.BKH, (ZYL + leftXie + data.BKH / H * leftQie) * sinA - ZYW * cosA),
                    new Vector3((ZYL + leftXie) * cosA + ZYW * sinA, 0, (ZYL + leftXie) * sinA - ZYW * cosA)
                ];
                frontface = H === 50 ? [
                    new Vector3((ZYL - data.ZYYFBH) * cosA, 0, (ZYL - data.ZYYFBH) * sinA),
                    new Vector3((ZYL - data.ZYYFBH + leftQie) * cosA, -data.BKH, (ZYL - data.ZYYFBH + leftQie) * sinA),
                    new Vector3((ZYL - data.ZYYFBH + leftXie + data.BKH / H * leftQie) * cosA + ZYW * sinA, -data.BKH, (ZYL - data.ZYYFBH + leftXie + data.BKH / H * leftQie) * sinA - ZYW * cosA),
                    new Vector3((ZYL - data.ZYYFBH + leftXie) * cosA + ZYW * sinA, 0, (ZYL - data.ZYYFBH + leftXie) * sinA - ZYW * cosA)
                ] : iszywequal ? [
                    new Vector3((ZYL - data.ZYYFBH) * cosA, 0, (ZYL - data.ZYYFBH) * sinA),
                    new Vector3((ZYL - data.ZYYFBH + leftQie) * cosA, -H, (ZYL - data.ZYYFBH + leftQie) * sinA),
                    new Vector3((ZYL - data.ZYYFBH + leftXie + data.BKH / H * leftQie) * cosA + (data.BKH) * sinA, -H, (ZYL - data.ZYYFBH + leftXie + data.BKH / H * leftQie) * sinA - (data.BKH) * cosA),
                    new Vector3((ZYL - data.ZYYFBH + leftXie) * cosA + (data.BKH) * sinA, 0, (ZYL - data.ZYYFBH + leftXie) * sinA - (data.BKH) * cosA)
                ] : [
                    new Vector3((ZYL - data.ZYYFBH) * cosA, 0, (ZYL - data.ZYYFBH) * sinA),
                    new Vector3((ZYL - data.ZYYFBH + leftQie) * cosA, -H, (ZYL - data.ZYYFBH + leftQie) * sinA),
                    new Vector3((ZYL - data.ZYYFBH + data.BKH / ZYW * leftXie + leftQie) * cosA + data.BKH * sinA, -H, (ZYL - data.ZYYFBH + data.BKH / ZYW * leftXie + leftQie) * sinA - data.BKH * cosA),
                    new Vector3((ZYL - data.ZYYFBH + data.BKH / ZYW * leftXie + data.BKH / H * leftQie) * cosA + data.BKH * sinA, -data.BKH, (ZYL - data.ZYYFBH + data.BKH / ZYW * leftXie + data.BKH / H * leftQie) * sinA - data.BKH * cosA),
                    new Vector3((ZYL - data.ZYYFBH + leftXie + data.BKH / H * leftQie) * cosA + ZYW * sinA, -data.BKH, (ZYL - data.ZYYFBH + leftXie + data.BKH / H * leftQie) * sinA - ZYW * cosA),
                    new Vector3((ZYL - data.ZYYFBH + leftXie) * cosA + ZYW * sinA, 0, (ZYL - data.ZYYFBH + leftXie) * sinA - ZYW * cosA)
                ];

                holes = [];

                let zzfenkw = AModelFmulaUtils.getHolesbyExpress(data.p_fbsk, H, 2);
                let zyfenkw = AModelFmulaUtils.getHolesbyExpress(data.p_yfenkw, ZYW, 2);
                if (H == 100 && ZYW == 100) {

                    let zfone = new Vector2(zyfenkw[0], -(data.BKH - data.BKKJMDis));
                    let zftwo = new Vector2((data.BKH - data.BKKJMDis), -zzfenkw[0]);

                    holePath = MoldUtils.getCapsulePath(zfone, zftwo, data.BKDia / 2);
                    holes.push(holePath);
                }
                else {
                    // 封板平孔
                    if (!iszywequal) {
                        for (i = 0; i < zyfenkw.length; i++) {
                            xv = zyfenkw[i];
                            yv = -(data.BKH - data.BKKJMDis);

                            let inPolygon = MoldUtils.inPolygon(new Vector2(xv, yv), path, data.BKDia / 2);
                            if (inPolygon) {
                                inPolygon = MoldUtils.checkPointPolygon(path, new Vector2(xv, yv));
                            }
                            if (!inPolygon) {
                                continue;
                            }

                            holePath = new Path()
                                .moveTo(xv, yv)
                                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                            holes.push(holePath);
                        }
                    }

                    if (H !== 50) {
                        // 封板竖孔
                        for (i = 0; i < zzfenkw.length; i++) {
                            xv = (data.BKH - data.BKKJMDis);
                            yv = -zzfenkw[i];

                            let inPolygon = MoldUtils.inPolygon(new Vector2(xv, yv), path, data.BKDia / 2);
                            if (inPolygon) {
                                inPolygon = MoldUtils.checkPointPolygon(path, new Vector2(xv, yv));
                            }
                            if (!inPolygon) {
                                continue;
                            }

                            holePath = new Path()
                                .moveTo(xv, yv)
                                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                            holes.push(holePath);
                        }
                    }
                }
            }
            let topvec = backface.concat(backface[0].clone());
            let bottomvec = frontface.concat(frontface[0].clone());

            // 侧边
            let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            // 形状
            let shape = new Shape().setFromPoints(path);
            // 挖孔
            if (holes && holes.length > 0) {
                let tmpholes = MoldUtils.getHoleByDivisions(holes);
                shape.holes.push(...tmpholes);
            }

            let geometry = new ShapeGeometry(shape);
            let positionAry = geometry.attributes.position;
            let indexAry = geometry.getIndex();

            // 顶点
            let vertex: any[] = []
            let index: any[] = [];

            let x: number, z: number;

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                x = a * sinA + (ZYL - b / H * leftQie) * cosA + a / ZYW * leftXie * cosA;
                z = -a * cosA + (ZYL - b / H * leftQie) * sinA + a / ZYW * leftXie * sinA;

                vertex.push(x, b, z);

            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(frontface.concat());

            count = Math.max(...indices) + 1;
            geometry.dispose();


            vertex = [];
            index = [];
            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                x = a * sinA + (ZYL - data.ZYYFBH - b / H * leftQie) * cosA + a / ZYW * leftXie * cosA;
                z = -a * cosA + (ZYL - data.ZYYFBH - b / H * leftQie) * sinA + a / ZYW * leftXie * sinA;
                vertex.push(x, b, z);

            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(backface.concat());

            count = Math.max(...indices) + 1;
            geometry.dispose();

        }

        // 右封
        if (data.p_yfentype != 2) {
            if (data.p_yfentype === 1) {
                let ymfh = H === 50 ? data.BKH + H : H;
                let ymfw = iszywequal ? data.BKH + YYW : YYW;
                path = [
                    new Vector2(0, 0),
                    new Vector2(0, ymfw),
                    new Vector2(-ymfh, ymfw),
                    new Vector2(-ymfh, 0)
                ];

                frontface = [
                    new Vector3(YYL, 0, 0),
                    new Vector3(YYL + rightXie, 0, ymfw),
                    new Vector3(YYL + rightXie + rightQie, -ymfh, ymfw),
                    new Vector3(YYL + rightQie, -ymfh, 0)
                ];

                backface = [
                    new Vector3(YYL - data.ZYYFBH, 0, 0),
                    new Vector3(YYL - data.ZYYFBH + rightXie, 0, ymfw),
                    new Vector3(YYL - data.ZYYFBH + rightXie + rightQie, -ymfh, ymfw),
                    new Vector3(YYL - data.ZYYFBH + rightQie, -ymfh, 0)
                ]

                holes = [];
                // count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 1, YYL, YYL - data.ZYYJXKH, true);
            }
            else {
                let yzfenkw = AModelFmulaUtils.getHolesbyExpress(data.p_fbsk, H, 2);
                let yyfenkw = AModelFmulaUtils.getHolesbyExpress(data.p_yfenkw, YYW, 2);


                path = H === 50 ? [
                    new Vector2(0, 0),
                    new Vector2(0, YYW),
                    new Vector2(-data.BKH, YYW),
                    new Vector2(-data.BKH, 0)
                ] : iszywequal ? [
                    new Vector2(0, 0),
                    new Vector2(0, data.BKH),
                    new Vector2(-H, data.BKH),
                    new Vector2(-H, 0)
                ] : [
                    new Vector2(0, 0),
                    new Vector2(0, YYW),
                    new Vector2(-data.BKH, YYW),
                    new Vector2(-data.BKH, data.BKH),
                    new Vector2(-H, data.BKH),
                    new Vector2(-H, 0)
                ];


                frontface = H === 50 ? [
                    new Vector3(YYL, 0, 0),
                    new Vector3(YYL, 0, YYW),
                    new Vector3(YYL, -data.BKH, YYW),
                    new Vector3(YYL, -data.BKH, 0)
                ] : iszywequal ? [
                    new Vector3(YYL, 0, 0),
                    new Vector3(YYL, 0, data.BKH),
                    new Vector3(YYL, -H, data.BKH),
                    new Vector3(YYL, -H, 0)
                ] : [
                    new Vector3(YYL, 0, 0),
                    new Vector3(YYL + rightXie, 0, YYW),
                    new Vector3(YYL + rightXie + data.BKH / H * rightQie, -data.BKH, YYW),
                    new Vector3(YYL + data.BKH / YYW * rightXie + data.BKH / H * rightQie, -data.BKH, data.BKH),
                    new Vector3(YYL + data.BKH / YYW * rightXie + rightQie, -H, data.BKH),
                    new Vector3(YYL + rightQie, -H, 0)
                ];

                backface = H === 50 ? [
                    new Vector3(YYL - data.ZYYFBH, 0, 0),
                    new Vector3(YYL - data.ZYYFBH, 0, YYW),
                    new Vector3(YYL - data.ZYYFBH, -data.BKH, YYW),
                    new Vector3(YYL - data.ZYYFBH, -data.BKH, 0)
                ] : iszywequal ? [
                    new Vector3(YYL - data.ZYYFBH, 0, 0),
                    new Vector3(YYL - data.ZYYFBH, 0, data.BKH),
                    new Vector3(YYL - data.ZYYFBH, -H, data.BKH),
                    new Vector3(YYL - data.ZYYFBH, -H, 0)
                ] : [
                    new Vector3(YYL - data.ZYYFBH, 0, 0),
                    new Vector3(YYL - data.ZYYFBH + rightXie, 0, YYW),
                    new Vector3(YYL - data.ZYYFBH + rightXie + data.BKH / H * rightQie, -data.BKH, YYW),
                    new Vector3(YYL - data.ZYYFBH + data.BKH / YYW * rightXie + data.BKH / H * rightQie, -data.BKH, data.BKH),
                    new Vector3(YYL - data.ZYYFBH + data.BKH / YYW * rightXie + rightQie, -H, data.BKH),
                    new Vector3(YYL - data.ZYYFBH + rightQie, -H, 0)
                ]

                holes = [];

                if (YYW == 100 && H == 100) {

                    let yfone = new Vector2(-(data.BKH - data.BKKJMDis), yyfenkw[0]);
                    let yftwo = new Vector2(-yzfenkw[0], (data.BKH - data.BKKJMDis));

                    holePath = MoldUtils.getCapsulePath(yfone, yftwo, data.BKDia / 2);
                    holes.push(holePath);
                }
                else {
                    if (!iszywequal) {
                        // 封板平孔
                        for (i = 0; i < yyfenkw.length; i++) {
                            xv = -(data.BKH - data.BKKJMDis);
                            yv = yyfenkw[i];

                            let inPolygon = MoldUtils.inPolygon(new Vector2(xv, yv), path, data.BKDia / 2);
                            if (inPolygon) {
                                inPolygon = MoldUtils.checkPointPolygon(path, new Vector2(xv, yv));
                            }
                            if (!inPolygon) {
                                continue;
                            }

                            holePath = new Path()
                                .moveTo(xv, yv)
                                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                            holes.push(holePath);
                        }
                    }

                    if (H !== 50) {
                        // 封板竖孔
                        for (i = 0; i < yzfenkw.length; i++) {
                            xv = -yzfenkw[i];
                            yv = (data.BKH - data.BKKJMDis);


                            let inPolygon = MoldUtils.inPolygon(new Vector2(xv, yv), path, data.BKDia / 2);
                            if (inPolygon) {
                                inPolygon = MoldUtils.checkPointPolygon(path, new Vector2(xv, yv));
                            }
                            if (!inPolygon) {
                                continue;
                            }

                            holePath = new Path()
                                .moveTo(xv, yv)
                                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                            holes.push(holePath);
                        }
                    }

                }
            }
            let topvec = backface.concat(backface[0].clone());
            let bottomvec = frontface.concat(frontface[0].clone());

            // 侧边
            let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            // 形状
            let shape = new Shape().setFromPoints(path);
            // 挖孔
            if (holes && holes.length > 0) {
                let tmpholes = MoldUtils.getHoleByDivisions(holes);
                shape.holes.push(...tmpholes);
            }

            let geometry = new ShapeGeometry(shape);
            let positionAry = geometry.attributes.position;
            let indexAry = geometry.getIndex();

            // 顶点
            let vertex: any[] = []
            let index: any[] = [];

            let x: number, z: number;

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                x = YYL + b / YYW * rightXie + Math.abs(a / H) * rightQie;
                vertex.push(x, a, b);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }


            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(frontface.concat());

            count = Math.max(...indices) + 1;

            vertex = [];
            index = [];
            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                x = YYL - data.ZYYFBH + b / YYW * rightXie + Math.abs(a / H) * rightQie;
                vertex.push(x, a, b);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }

            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(backface.concat());

            count = Math.max(...indices) + 1;

            geometry.dispose();

        }

        return [vertices, indices, facevec];
    }


    /**
     * 转角板/抬头板
     * @param data 
     * @returns 
     */
    static getBoardCornerVI(data: ALParams): any[] {

        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let radian = data.p_jiajiao / 180 * Math.PI;
        let cosA = Math.cos(radian);
        let sinA = Math.sin(radian);

        let radianBan = data.p_jiajiao / 2 / 180 * Math.PI;
        let tanC = Math.tan(radianBan);
        let minRX = data.BKH / tanC

        let xra = data.XBNXJD / 180 * Math.PI;
        let sinB = Math.sin(xra);
        let cosB = Math.cos(xra);
        let tanB = Math.tan(xra);

        let len: number;

        let ZYL = Number(data.zyL);
        let YYL = Number(data.yyL);
        let H = Number(data.H);

        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        let xv: number, yv: number, i: number;
        let backface: Vector3[], frontface: Vector3[];
        let backpath: Vector2[], fontpath: Vector2[];
        let fontp: any[], backp: any[];

        let filterNum: number = 0;

        // 转角点
        let xx: number = data.GMT / sinA + data.GMT / sinA * cosA;

        len = data.p_zksctype === 1 ? -data.GMT / tanB : data.p_zksctype === 2 ? data.GMT / tanB : 0
        // 左侧面孔
        holes = [];
        MoldUtils.getGmtHoles(data.p_l_r1, data.p_l_r1dw, holes, 0);
        MoldUtils.getGmtHoles(data.p_l_r2, data.p_l_r2dw, holes, 0);
        MoldUtils.getGmtHoles(data.p_l_r3, data.p_l_r3dw, holes, 0);

        fontp = MoldUtils.getLeftXieVi(0, 0, ZYL, sinA, cosA);
        backp = MoldUtils.getLeftXieVi(data.GMT, data.GMT, ZYL, sinA, cosA);

        backpath = [
            new Vector2(0, 0),
            new Vector2(fontp[2], 0),
            new Vector2(fontp[2], H),
            new Vector2(0, H)
        ]
        backface = MoldUtils.getLeftXieFaceVI(0, 0, ZYL, 0, H, sinA, cosA);

        fontpath = [
            new Vector2(0, 0),
            new Vector2(backp[2] + len, 0),
            new Vector2(backp[2] + len, H),
            new Vector2(0, H)
        ]
        frontface = MoldUtils.getLeftXieFaceVI(data.GMT, data.GMT, ZYL + len, 0, H, sinA, cosA);

        count = MoldUtils.getLeftHoleVI(count, vertices, indices, facevec, holes, holes, backpath, fontpath, backface, frontface, data.GMT, data.GMT, data.GMT, sinA, cosA);

        // 右侧面孔
        holes = [];
        MoldUtils.getGmtHoles(data.p_r_r1, data.p_r_r1dw, holes, 0);
        MoldUtils.getGmtHoles(data.p_r_r2, data.p_r_r2dw, holes, 0);
        MoldUtils.getGmtHoles(data.p_r_r3, data.p_r_r3dw, holes, 0);
        len = data.p_yksctype === 1 ? -data.GMT / tanB : data.p_yksctype === 2 ? data.GMT / tanB : 0
        count = MoldUtils.getRightHoleVI(count, vertices, indices, facevec, holes, 0, xx, YYL, YYL + len, 0, H, 0, data.GMT, cosA, sinA, data.BKH, data.BKH);

        // 左边框
        len = data.p_zksctype === 0 ? data.BKH : data.BKH / sinB;
        let cc = data.p_zksctype === 1 ? -data.BKH / tanB : data.p_zksctype === 2 ? data.BKH / tanB : 0;

        path = [
            new Vector2(0, 0),
            new Vector2(0, H),
            new Vector2(data.BKH, H),
            new Vector2(data.BKH, 0)
        ];
        backface = [
            new Vector3(ZYL * cosA, 0, ZYL * sinA),
            new Vector3(ZYL * cosA, H, ZYL * sinA),
            new Vector3((ZYL + cc) * cosA + data.BKH * sinA, H, (ZYL + cc) * sinA - data.BKH * cosA),
            new Vector3((ZYL + cc) * cosA + data.BKH * sinA, 0, (ZYL + cc) * sinA - data.BKH * cosA)
        ];
        frontface = [
            new Vector3((ZYL - data.bkT) * cosA, 0, (ZYL - data.bkT) * sinA),
            new Vector3((ZYL - data.bkT) * cosA, H, (ZYL - data.bkT) * sinA),
            new Vector3((ZYL - data.bkT + cc) * cosA + data.BKH * sinA, H, (ZYL - data.bkT + cc) * sinA - data.BKH * cosA),
            new Vector3((ZYL - data.bkT + cc) * cosA + data.BKH * sinA, 0, (ZYL - data.bkT + cc) * sinA - data.BKH * cosA)
        ];


        let zkkw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, H, 2, data, AK.p_zkkw);
        filterNum = 0;
        holes = [];
        for (i = 0; i < zkkw.length; i++) {
            xv = (data.BKH - data.BKKJMDis);
            yv = zkkw[i];
            // 过滤孔
            if (yv > H - data.BKDia / 2 || yv < data.BKDia / 2) {
                filterNum++;
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, H, 2, data, AK.p_zkkw, filterNum);

        let topvec = frontface.concat(frontface[0].clone());
        let bottomvec = backface.concat(backface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(bottomvec, topvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];


        // 形状
        let shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let positionAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();

        // 顶点
        let vertex: any[] = []
        let index: any[] = [];

        let cx = cc * cosA;
        let cy = cc * sinA;
        let x: number, z: number;
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            x = a * sinA + ZYL * cosA + a / len * cx;
            z = -a * cosA + ZYL * sinA + a / len * cy;

            vertex.push(x, b, z);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        // index.reverse() 
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(frontface.concat());

        count = Math.max(...indices) + 1;

        vertex = [];
        index = [];
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            x = a * sinA + (ZYL - data.bkT) * cosA + a / len * cx;
            z = -a * cosA + (ZYL - data.bkT) * sinA + a / len * cy;

            vertex.push(x, b, z);

        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(backface.concat());

        count = Math.max(...indices) + 1;

        len = data.p_yksctype === 0 ? data.BKH : data.BKH / sinB;
        // 右边框
        path = [
            new Vector2(0, 0),
            new Vector2(H, 0),
            new Vector2(H, len),
            new Vector2(0, len)
        ]
        let ykkw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, H, 2, data, AK.p_ykkw);
        holes = [];
        filterNum = 0;
        for (i = 0; i < ykkw.length; i++) {
            xv = zkkw[i];
            yv = (data.BKH - data.BKKJMDis);
            // 过滤孔
            if (xv > H - data.BKDia / 2 || xv < data.BKDia / 2) {
                filterNum++;
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, H, 2, data, AK.p_ykkw, filterNum);

        if (data.p_yksctype === 0) {
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, YYL, YYL - data.bkT, true);
        }
        else if (data.p_yksctype === 1) {
            // 内斜
            count = MoldUtils.getXieShapeVI(count, vertices, indices, facevec, path, path, holes, sinB, cosB, 0, 1, YYL, YYL - data.bkT, true)
        }
        else if (data.p_yksctype === 2) {
            // 外斜
            count = MoldUtils.getXieShapeVI(count, vertices, indices, facevec, path, path, holes, sinB, cosB, 1, 1, YYL, YYL - data.bkT, true)
        }

        path = MoldUtils.getCornerPath(0, data.BKH, data.BKH, ZYL, YYL, sinA, cosA);
        path[2].x = path[2].x + cc * cosA;
        path[2].y = path[2].y + cc * sinA;

        let yx = data.p_yksctype === 1 ? -data.BKH / tanB : data.p_yksctype === 2 ? data.BKH / tanB : 0;
        path[4].x += yx;

        // 上
        if (data.p_sfentype === 0) {

            holes = [];
            // 上左翼孔
            let szykw = AModelFmulaUtils.getHolesbyExpress(data.p_szykw, ZYL, 2, data, AK.p_szykw);
            filterNum = 0;
            for (i = 0; i < szykw.length; i++) {
                xv = szykw[i] * cosA + (data.BKH - data.BKKJMDis) * sinA;
                yv = szykw[i] * sinA - (data.BKH - data.BKKJMDis) * cosA;
                // 过滤孔
                if (szykw[i] > ZYL - data.BKDia / 2 || szykw[i] < minRX + data.BKDia / 2) {
                    filterNum++;
                    continue;
                }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            AModelFmulaUtils.getHolesbyExpress(data.p_szykw, ZYL, 2, data, AK.p_szykw, filterNum);

            // 上右翼孔
            let syykw = AModelFmulaUtils.getHolesbyExpress(data.p_syykw, YYL, 2, data, AK.p_syykw);
            filterNum = 0;
            for (i = 0; i < syykw.length; i++) {
                xv = syykw[i];
                yv = (data.BKH - data.BKKJMDis);

                // 过滤孔
                if (xv > YYL - data.BKDia / 2 || xv < minRX + data.BKDia / 2) {
                    filterNum++;
                    continue;
                }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }

            AModelFmulaUtils.getHolesbyExpress(data.p_syykw, YYL, 2, data, AK.p_syykw, filterNum);

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, H, H - data.bkT, false);
        }


        // 下
        if (data.p_xfentype === 0) {
            holes = [];
            // 下左翼孔
            let xzykw = AModelFmulaUtils.getHolesbyExpress(data.p_xzykw, ZYL, 2, data, AK.p_xzykw);
            filterNum = 0;
            for (i = 0; i < xzykw.length; i++) {
                xv = xzykw[i] * cosA + (data.BKH - data.BKKJMDis) * sinA;
                yv = xzykw[i] * sinA - (data.BKH - data.BKKJMDis) * cosA;
                // 过滤孔
                if (xzykw[i] > ZYL - data.BKDia / 2 || xzykw[i] < minRX + data.BKDia / 2) {
                    filterNum++;
                    continue;
                }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            AModelFmulaUtils.getHolesbyExpress(data.p_xzykw, ZYL, 2, data, AK.p_xzykw, filterNum);

            // 下右翼孔
            let xyykw = AModelFmulaUtils.getHolesbyExpress(data.p_xyykw, YYL, 2, data, AK.p_xyykw);
            filterNum = 0;
            for (i = 0; i < xyykw.length; i++) {
                xv = xyykw[i];
                yv = (data.BKH - data.BKKJMDis);

                // 过滤孔
                if (xv > YYL - data.BKDia / 2 || xv < minRX + data.BKDia / 2) {
                    filterNum++;
                    continue;
                }

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            AModelFmulaUtils.getHolesbyExpress(data.p_xyykw, YYL, 2, data, AK.p_xyykw, filterNum);

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, data.bkT, 0, false);
        }

        return [vertices, indices, facevec];
    }

    /**
     * 飞机板
     * @param data 
     * @returns 
     */
    static getBoardFlyVI(data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let SKH = Number(data.SKH);
        let XKH = Number(data.XKH);
        let ZKH = Number(data.ZKH);
        let YKH = Number(data.YKH);
        let L = Number(data.L);
        let W = Number(data.W);

        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        let xv: number, yv: number, i: number;

        // 光面
        path = [
            new Vector2(0, 0),
            new Vector2(W, 0),
            new Vector2(W, L),
            new Vector2(0, L)
        ];

        holes = [];
        MoldUtils.getGmtHoles(data.p_r1, data.p_r1dw, holes);
        MoldUtils.getGmtHoles(data.p_r2, data.p_r2dw, holes);
        MoldUtils.getGmtHoles(data.p_r3, data.p_r3dw, holes);

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.GMT, 0, true);

        // 左侧
        let zkdw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
        if (data.p_zksctype === 0) {

            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, data.ZYKH, 0, L, 0, ZKH);

            path = [
                new Vector2(0, 0),
                new Vector2(0, L),
                new Vector2(-ZKH, L),
                new Vector2(-ZKH, 0)
            ]
            holes = [];
            for (let i = 0; i < zkdw.length; i++) {
                xv = -(ZKH - data.BKKJMDis);
                yv = zkdw[i];

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.ZYKH, 0, true);
        }
        else {
            path = [
                new Vector2(0, 0),
                new Vector2(L, 0),
                new Vector2(L, ZKH),
                new Vector2(0, ZKH)
            ]
            holes = [];
            for (let i = 0; i < zkdw.length; i++) {
                xv = zkdw[i];
                yv = ZKH - data.BKKJMDis;

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, data.ZYKH, 0, true);
        }


        // 右侧
        let ykdw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
        if (data.p_yksctype === 0) {
            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, W - data.ZYKH, W, 0, L, 0, YKH);

            path = [
                new Vector2(W, 0),
                new Vector2(W + YKH, 0),
                new Vector2(W + YKH, L),
                new Vector2(W, L)
            ]
            holes = [];
            for (let i = 0; i < ykdw.length; i++) {
                xv = W + YKH - data.BKKJMDis;
                yv = ykdw[i];

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.ZYKH, 0, true);
        }
        else {
            path = [
                new Vector2(0, 0),
                new Vector2(L, 0),
                new Vector2(L, YKH),
                new Vector2(0, YKH)
            ]
            holes = [];
            for (let i = 0; i < ykdw.length; i++) {
                xv = ykdw[i];
                yv = YKH - data.BKKJMDis;

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, W, W - data.ZYKH, true);
        }

        // 顶
        if (data.p_sksctype != 1) {
            path = [
                new Vector2(0, 0),
                new Vector2(0, SKH),
                new Vector2(W, SKH),
                new Vector2(W, 0)
            ]

            let skkw = AModelFmulaUtils.getHolesbyExpress(data.p_skkw, W, 2, data, AK.p_skkw);
            holes = [];
            for (let i = 0; i < skkw.length; i++) {
                xv = skkw[i];
                yv = SKH - data.BKKJMDis;

                holePath = new Path()
                    .moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, L, L - data.SXKH, false);
        }

        // 底
        path = [
            new Vector2(0, 0),
            new Vector2(0, XKH),
            new Vector2(W, XKH),
            new Vector2(W, 0)
        ]

        let xkkw = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
        holes = [];
        for (let i = 0; i < xkkw.length; i++) {
            xv = xkkw[i];
            yv = XKH - data.BKKJMDis;

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        if (data.p_xksctype != 1) {
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, data.SXKH, 0, false);
        }

        // 角铝
        if (data.p_isdjl === 1) {

            if (data.p_xksctype != 1) {
                count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, 0, -data.SXKH, false, false, false);
            }
            else {
                count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, 0, -data.SXKH, false);
            }
            // 背板
            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, W, -data.JLH, 0, 0, data.GMT);
        }


        // 横肋
        let hldw = AModelFmulaUtils.getHolesbyExpress(data.p_hldw, 0, 2, data, AK.p_hldw);
        if (hldw && hldw.length > 0) {
            let p: number;
            let hlw: number = Number(data.HLW);
            let hlh: number = Number(data.HLH);
            if (hlw > 0 && hlh > 0) {
                for (i = 0; i < hldw.length; i++) {
                    p = hldw[i];
                    count = MoldUtils.getCuboidVI(count, vertices, indices, facevec,
                        data.ZYKH, W - data.ZYKH, p - hlw / 2, p + hlw / 2, data.GMT, data.GMT + hlh);
                }
            }
        }

        return [vertices, indices, facevec];
    }

    /**
     * 普通支撑、梁底支撑
     * @param data 
     * @param type 0 普通支撑 1 梁底支撑 2 支撑托板
     * @returns 
     */
    static getBraceVI(data: ALParams, type: number = 0): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];

        // 计数
        let count: number = 0;
        // 形状
        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        let W: number = Number(data.W);
        let L: number = Number(data.L);

        // 坐标
        let i: number, xv: number, yv: number;

        // 光面
        count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, L, -data.GMT, 0, 0, W);

        //上
        if (type != 1) {
            path = type === 0 ? [
                new Vector2(0, 0),
                new Vector2(0, W),
                new Vector2(-data.SKH, W),
                new Vector2(-data.SKH, 0)
            ] : [
                new Vector2(0, 0),
                new Vector2(data.SKH, 0),
                new Vector2(data.SKH, W),
                new Vector2(0, W)
            ]

            holes = [];
            let skkw = AModelFmulaUtils.getHolesbyExpress(data.p_skkw, W, 2, data, AK.p_skkw);
            for (i = 0; i < skkw.length; i++) {
                xv = type === 0 ? -(data.SKH - data.BKKJMDis) : (data.SKH - data.BKKJMDis);
                yv = skkw[i];

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, L, L - data.SXKH, true);

            // 下
            path = type === 0 ? [
                new Vector2(0, 0),
                new Vector2(0, W),
                new Vector2(-data.XKH, W),
                new Vector2(-data.XKH, 0)
            ] : [
                new Vector2(0, 0),
                new Vector2(data.XKH, 0),
                new Vector2(data.XKH, W),
                new Vector2(0, W)
            ]
            holes = [];
            let xkkw = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
            for (i = 0; i < xkkw.length; i++) {
                xv = type === 0 ? -(data.XKH - data.BKKJMDis) : (data.XKH - data.BKKJMDis);
                yv = xkkw[i];

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, data.SXKH, 0, true);
        }

        // 左
        path = type === 2 ? [
            new Vector2(0, 0),
            new Vector2(L, 0),
            new Vector2(L, data.ZKH),
            new Vector2(0, data.ZKH)
        ] : [
            new Vector2(0, 0),
            new Vector2(0, -data.ZKH),
            new Vector2(L, -data.ZKH),
            new Vector2(L, 0)
        ]
        let zkkw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
        holes = [];
        for (i = 0; i < zkkw.length; i++) {
            xv = zkkw[i];
            yv = type === 2 ? (data.ZKH - data.BKKJMDis) : -(data.ZKH - data.BKKJMDis);

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.ZYKH, 0, true);
        // 右
        path = type === 2 ? [
            new Vector2(0, 0),
            new Vector2(L, 0),
            new Vector2(L, data.YKH),
            new Vector2(0, data.YKH)
        ] : [
            new Vector2(0, 0),
            new Vector2(0, -data.YKH),
            new Vector2(L, -data.YKH),
            new Vector2(L, 0)
        ]
        let ykkw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
        holes = [];
        for (i = 0; i < ykkw.length; i++) {
            xv = ykkw[i];
            yv = type === 2 ? (data.YKH - data.BKKJMDis) : -(data.YKH - data.BKKJMDis);

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, W, W - data.ZYKH, true);

        if (type != 2) {

            let cxdw = data.p_cxdw.split(',');
            let kxpy = data.p_kxpy.split(',');
            let p_cxdw: number = 0;
            let p_kxpy: number = 0;
            // 支撑
            if (data.p_zcsl === 1) {

                p_cxdw = Number(cxdw[0]);
                p_kxpy = Number(kxpy[0]);

                count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, -data.GMT);
            }
            else if (data.p_zcsl === 2) {

                p_kxpy = Number(kxpy[0]);

                if (Number(cxdw[1]) > 0) {
                    p_cxdw = Number(cxdw[0]);

                    count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, - data.GMT);

                    p_kxpy = Number(kxpy[1]) > 0 ? Number(kxpy[1]) : Number(kxpy[0]);

                    p_cxdw = Number(cxdw[1]) + Number(cxdw[0]);
                    count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, -data.GMT);
                }
                else {
                    data.p_cxdw = (L * 1 / 3).toFixed(2) + ',' + (L * 1 / 3).toFixed(2);

                    count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 1 / 3, p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, - data.GMT);

                    p_kxpy = Number(kxpy[1]) > 0 ? Number(kxpy[1]) : Number(kxpy[0]);

                    count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 2 / 3, p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, - data.GMT);
                }


            }
            else if (data.p_zcsl === 3) {


                // count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L / 4 + p_cxdw, W / 2 + p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, -data.GMT);
                // count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L / 2 + p_cxdw, W / 2 + p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, -data.GMT);
                // count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 3 / 4 + p_cxdw, W / 2 + p_kxpy, data.ZCGdia, -data.zcgL - data.GMT, -data.GMT);
            }
        }

        return [vertices, indices, facevec];
    }

    /**
     * 楼面支撑
     * @param data 
     * @returns 
     */
    static getBraceFloorVI(data: ALParams): any {

        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let L = Number(data.L);
        let W = Number(data.W);
        let H = Number(data.H);
        let XQNXJL = Number(data.XQNXJL);

        let path: Vector2[];

        // 顶
        count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, L, -data.GMT, 0, 0, W);
        // 底
        count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, XQNXJL, L - XQNXJL, -H, -H + data.GMT, 0, W);
        // 前
        path = [
            new Vector2(0, 0),
            new Vector2(XQNXJL, -H),
            new Vector2(L - XQNXJL, -H),
            new Vector2(L, 0)
        ];

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 0, data.GMT, 0, true);
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 0, W, W - data.GMT, true);

        // 支撑
        count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L / 2, W / 2, data.ZCGdia, -H - data.zcgL, -H);

        return [vertices, indices, facevec];
    }

    /**
     * 单/双斜铝梁
     * @param data 
     * @param dside 
     * @returns 
     */
    static getBraceBeamVI(data: ALParams, dside: boolean): any[] {

        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;
        let i: number, xv: number, yv: number;

        let L = Number(data.L);
        let W = Number(data.W);
        let H = Number(data.H);
        let XBWXJL = Number(data.XBWXJL);

        let minx = dside ? XBWXJL : 0;
        let maxx = L - XBWXJL;
        // 顶
        count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, minx, maxx, -data.GMT, 0, 0, W);
        // 底
        count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, L, -H, -H + data.GMT, -data.ztjbW, W + data.ztjbW);
        // 下边框
        if (!dside) {
            path = [
                new Vector2(0, 0),
                new Vector2(-H, 0),
                new Vector2(-H, W),
                new Vector2(0, W)
            ]

            let xkdw = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
            holes = [];
            for (i = 0; i < xkdw.length; i++) {

                xv = -data.BKKJMDis;
                yv = xkdw[i];

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);
            }
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, 0, data.SXKH, false);
        }

        // 左边框
        path = [
            new Vector2(minx, 0),
            new Vector2(0, -H),
            new Vector2(L, -H),
            new Vector2(maxx, 0)
        ]
        let zkdw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
        holes = [];
        for (i = 0; i < zkdw.length; i++) {

            xv = zkdw[i];
            yv = -data.BKKJMDis;

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.ZYKH, 0, true);

        // 右边框
        let ykdw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
        holes = [];
        for (i = 0; i < ykdw.length; i++) {

            xv = ykdw[i];
            yv = -data.BKKJMDis;

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, W, W - data.ZYKH, true);

        // 下
        if (dside) {
            // 左
            holes = [];

            xv = data.gdjL / 2;
            yv = -H - (data.gdjH - data.GDJKGDDW);

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);


            path = [
                new Vector2(0, -H),
                new Vector2(0, -H - data.gdjH),
                new Vector2(data.gdjL, -H - data.gdjH),
                new Vector2(data.gdjL, -H)
            ]

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, (W - data.gdjW) / 2 + data.ZYKH, (W - data.gdjW) / 2, true);
            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, (W - data.gdjW) / 2 + data.gdjW, (W - data.gdjW) / 2 + data.gdjW - data.ZYKH, true);
            //底
            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, data.gdjL, -H - data.gdjH, -H - data.gdjH + data.GMT, (W - data.gdjW) / 2 - data.gdjjbW, (W - data.gdjW) / 2 + data.gdjW + data.gdjjbW);
        }

        // 下右
        path = [
            new Vector2(L - data.gdjL, -H),
            new Vector2(L - data.gdjL, -H - data.gdjH),
            new Vector2(L, -H - data.gdjH),
            new Vector2(L, -H)
        ]

        holes = [];

        xv = L - data.gdjL / 2;
        yv = -H - (data.gdjH - data.GDJKGDDW);

        holePath = new Path();
        holePath.moveTo(xv, yv)
            .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

        holes.push(holePath);

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, (W - data.gdjW) / 2 + data.ZYKH, (W - data.gdjW) / 2, true);
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, (W - data.gdjW) / 2 + data.gdjW, (W - data.gdjW) / 2 + data.gdjW - data.ZYKH, true);

        //底
        count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, L - data.gdjL, L, -H - data.gdjH, -H - data.gdjH + data.GMT, (W - data.gdjW) / 2 - data.gdjjbW, (W - data.gdjW) / 2 + data.gdjW + data.gdjjbW);

        return [vertices, indices, facevec];
    }

    /**
     * 获取梯形滴水线
     * @param count 
     * @param vertices 
     * @param indices 
     * @param facevec 
     * @param topPath 
     * @param bottomPath 
     * @param miny 
     * @param maxy 
     * @param sidereverse 
     * @returns 
     */
    static getDripLineVI(count: number, vertices: any[], indices: any[], facevec: any[],
        topPath: Vector2[], bottomPath: Vector2[], miny: number, maxy: number, sidereverse: boolean = true): number {

        let top: Vector3, bottom: Vector3;
        let topface: Vector3[] = [], bottomface: Vector3[] = [];
        for (let i = 0; i < topPath.length; i++) {

            bottom = new Vector3(bottomPath[i].x, miny, bottomPath[i].y);
            top = new Vector3(topPath[i].x, maxy, topPath[i].y);

            bottomface.push(bottom);
            topface.push(top);
        }

        let topvec = sidereverse ? bottomface.concat(bottomface[0].clone()) : topface.concat(topface[0].clone());
        let bottomvec = sidereverse ? topface.concat(topface[0].clone()) : bottomface.concat(bottomface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 顶面
        let shape = new Shape().setFromPoints(topPath);
        let geometry = new ShapeGeometry(shape);
        let positionAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();

        let vertex: any[] = []
        let index: any[] = [];

        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];

            vertex.push(a, maxy, b);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }
        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(topface.concat());

        count = Math.max(...indices) + 1;
        geometry.dispose();

        return count;
    }


    /**
     * 企口支撑
     * @param data 
     * @returns 
     */
    static getBraceRabbetVI(data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;
        let i: number, xv: number, yv: number;

        let L = Number(data.L);
        let W = Number(data.W);
        let pkH = Number(data.pkH);
        let pkW = Number(data.pkW);
        let qkW = W - Number(data.qkW);

        data.duan = [
            0, 0, 0,
            L, 0, 0,
            0, pkH, -W,
            L, pkH, -W
        ]

        data.zhong = {
            L: [
                {
                    pointer: [L, pkH, -W / 2],
                    center: [L / 2, pkH, -W / 2],
                    dir: [L, pkH, -W]
                },
            ],
            RL: [
                {
                    pointer: [0, pkH, -W / 2,],
                    center: [L / 2, pkH, -W / 2],
                    dir: [0, pkH, -W]
                },
            ]

        }
        // 边框孔中心点

        if (data.p_dripLinetype === 1) {

            let txdsxtopL = data.txdsx_topL;
            let txdsxbottomL = data.txdsx_bottomL;
            let txdsxH = data.txdsx_H;
            let dsxbj = data.dsxbj;

            let btdv = (txdsxbottomL - txdsxtopL) / 2;
            let topPath = [
                new Vector2(0, -W + dsxbj + btdv),
                new Vector2(0, -W + dsxbj + txdsxbottomL - btdv),
                new Vector2(L, -W + dsxbj + txdsxbottomL - btdv),
                new Vector2(L, -W + dsxbj + btdv)
            ]

            let bottomPath = [
                new Vector2(0, -W + dsxbj),
                new Vector2(0, -W + dsxbj + txdsxbottomL),
                new Vector2(L, -W + dsxbj + txdsxbottomL),
                new Vector2(L, -W + dsxbj)
            ]

            count = MoldUtils.getDripLineVI(count, vertices, indices, facevec, topPath, bottomPath, pkH, pkH + txdsxH);
        }

        if (pkH <= 0) {
            // 顶
            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, L, -data.GMT, 0, -W, 0);
        }
        else {
            // 顶后
            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, L, pkH - data.GMT, pkH, -W, -pkW - qkW);
            // 顶前
            count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, L, -data.GMT, 0, -qkW, 0);
            // 顶斜
            let xy = MoldUtils.getXY(pkH, pkW, data.GMT);
            let x = xy[0];
            let y = xy[1];

            path = [
                new Vector2(pkH, -qkW - pkW),
                new Vector2(0, -qkW),
                new Vector2(0 - x, -qkW - y),
                new Vector2(pkH - x, -qkW - pkW - y)
            ]

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 1, 0, L, false, true);
        }

        // 右侧
        path = [
            new Vector2(0, 0),
            new Vector2(0, -data.BKH),
            new Vector2(L, -data.BKH),
            new Vector2(L, 0)
        ]

        let ykkw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
        holes = [];

        for (i = 0; i < ykkw.length; i++) {
            xv = ykkw[i];
            yv = -(data.BKH - data.BKKJMDis);

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);


        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, -data.ZYKH, 0, false, true);
        // 左侧
        path = [
            new Vector2(0, pkH),
            new Vector2(0, -data.BKH),
            new Vector2(L, -data.BKH),
            new Vector2(L, pkH)
        ]

        let zkkw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
        holes = [];

        for (i = 0; i < zkkw.length; i++) {
            xv = zkkw[i];
            yv = -(data.BKH - data.BKKJMDis);

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);

        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, -W, -W + data.ZYKH, false, true);

        // 上侧
        path = [
            new Vector2(pkH, -W),
            new Vector2(-data.BKH, -W),
            new Vector2(-data.BKH, 0),
            new Vector2(0, 0),
            new Vector2(0, -qkW),
            new Vector2(pkH, -qkW - pkW)
        ]
        let skkw = AModelFmulaUtils.getHolesbyExpress(data.p_skkw, W, 2, data, AK.p_skkw);
        holes = [];

        for (i = 0; i < skkw.length; i++) {
            xv = -(data.BKH - data.BKKJMDis);
            yv = -skkw[i];

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);


        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, 0, data.SXKH, false);

        // 下侧
        let xkkw = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
        holes = [];

        for (i = 0; i < xkkw.length; i++) {
            xv = -(data.BKH - data.BKKJMDis);
            yv = -xkkw[i];

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);

        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, L - data.SXKH, L, false);

        // 支撑
        if (data.p_zcsl != 0) {

            if (data.p_cxdw === "") {
                data.p_cxdw = MeshGeomLib.getInt(L / 2, 2) + '';
            }
        }

        let cxdw = data.p_cxdw.toString().split(',');

        let p_cxdw: number = 0;

        // let p_kxpy = data.p_kxpy ? Number(data.p_kxpy) : 0;
        let miny = -data.zcgL + pkH - data.GMT;
        let maxy = pkH - data.GMT;

        data.zcdata = [];
        // 支撑
        if (data.p_zcsl === 1) {
            p_cxdw = Number(cxdw[0]);

            count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, -W / 2, data.ZCGdia, miny, maxy);

            data.zcdata.push(p_cxdw, maxy, -W / 2);
            data.zcdata.push(p_cxdw, miny, -W / 2);
        }
        else if (data.p_zcsl === 2) {
            p_cxdw = Number(cxdw[0]);

            if (Number(cxdw[1]) > 0) {
                p_cxdw = Number(cxdw[0]);

                count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, -W / 2, data.ZCGdia, miny, maxy);

                data.zcdata.push(p_cxdw, maxy, -W / 2);
                data.zcdata.push(p_cxdw, miny, -W / 2);


                p_cxdw = Number(cxdw[1]) + Number(cxdw[0]);
                count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, -W / 2, data.ZCGdia, miny, maxy);

                data.zcdata.push(p_cxdw, maxy, -W / 2);
                data.zcdata.push(p_cxdw, miny, -W / 2);
            }
            else {
                data.p_cxdw = MeshGeomLib.getInt(L * 1 / 3, 2) + ',' + MeshGeomLib.getInt(L * 1 / 3, 2);

                count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 1 / 3, -W / 2, data.ZCGdia, miny, maxy);
                data.zcdata.push(L * 1 / 3, maxy, -W / 2);
                data.zcdata.push(L * 1 / 3, miny, -W / 2);

                count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 2 / 3, -W / 2, data.ZCGdia, miny, maxy);
                data.zcdata.push(L * 2 / 3, maxy, -W / 2);
                data.zcdata.push(L * 2 / 3, miny, -W / 2);
            }

        }
        // else if (data.p_zcsl === 3) {
        //     count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L / 4 + p_cxdw, -W / 2, data.ZCGdia, miny, maxy);
        //     count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L / 2 + p_cxdw, -W / 2, data.ZCGdia, miny, maxy);
        //     count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 3 / 4 + p_cxdw, -W / 2, data.ZCGdia, miny, maxy);
        // }

        return [vertices, indices, facevec];
    }


    /**
     * 沉降倒角平板
     * @param data 
     * @returns 
     */
    static getSectionChamferVI(data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let path: Vector2[];
        let holePath: Path;
        let holes: Path[];

        let L = Number(data.L);
        let W = Number(data.W);

        let DJXQW = Number(data.DJXQW);
        let DJXQH = Number(data.DJXQH);

        let i: number, xv: number, yv: number;
        // 背板
        path = [
            new Vector2(0, 0),
            new Vector2(0, -W + DJXQW),
            new Vector2(L, -W + DJXQW),
            new Vector2(L, 0)
        ];

        holes = [];
        MoldUtils.getGmtHoles(data.p_r1, data.p_r1dw, holes, 0, true);
        MoldUtils.getGmtHoles(data.p_r2, data.p_r2dw, holes, 0, true);
        MoldUtils.getGmtHoles(data.p_r3, data.p_r3dw, holes, 0, true);
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 0, data.GMT, 0, true);

        // 底板
        count = MoldUtils.getCuboidVI(count, vertices, indices, facevec, 0, L, -W, -W + data.GMT, DJXQH, data.BKH); // 底 

        // 斜面
        let xy = MoldUtils.getXY(DJXQW, DJXQH, data.GMT);
        let x = xy[0];
        let y = xy[1];

        path = [
            new Vector2(-W + DJXQW, 0),
            new Vector2(-W, DJXQH),
            new Vector2(-W + x, DJXQH + y),
            new Vector2(-W + DJXQW + x, y)
        ]
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 1, 0, L, false);

        // 下框
        path = [
            new Vector2(0, 0),
            new Vector2(-W + DJXQW, 0),
            new Vector2(-W, DJXQH),
            new Vector2(-W, data.BKH),
            new Vector2(0, data.BKH)
        ];

        let xkdw = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
        holes = [];
        for (i = 0; i < xkdw.length; i++) {
            xv = - xkdw[i];
            yv = data.BKH - data.BKKJMDis;
            if (xv < -W + DJXQW * yv / W + data.BKDia / 2) {
                continue;
            }
            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, 0, data.bkT, false);
        // 上框
        let skdw = AModelFmulaUtils.getHolesbyExpress(data.p_skkw, W, 2, data, AK.p_skkw);
        holes = [];
        for (i = 0; i < skdw.length; i++) {
            xv = - skdw[i];
            yv = data.BKH - data.BKKJMDis;
            if (xv < -W + DJXQW * yv / W + data.BKDia / 2) {
                continue;
            }
            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, L - data.bkT, L, false);

        // 左框
        path = [
            new Vector2(0, 0),
            new Vector2(0, data.BKH),
            new Vector2(L, data.BKH),
            new Vector2(L, 0)
        ]
        let zkdw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
        holes = [];
        for (i = 0; i < zkdw.length; i++) {
            xv = zkdw[i];
            yv = data.BKH - data.BKKJMDis;
            if (xv > L - data.BKDia / 2) {
                continue;
            }
            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, 0, -data.bkT, false);

        return [vertices, indices, facevec];
    }


    /**
     * 沉降倒角转角板
     * @param data 
     * @returns 
     */
    static getSectionChamferCornerVI(data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let radian = data.p_jiajiao / 180 * Math.PI;
        let cosA = Math.cos(radian);
        let sinA = Math.sin(radian);

        let radianBan = data.p_jiajiao / 2 / 180 * Math.PI;
        let tanC = Math.tan(radianBan);
        let minRX = data.BKH / tanC;

        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        let xv: number, yv: number, i: number;
        let backface: Vector3[], frontface: Vector3[];
        let backpath: Vector2[], fontpath: Vector2[];
        let fontp: any[], backp: any[];

        let DJXQW = Number(data.DJXQW);
        let DJXQH = Number(data.DJXQH);
        // 顶
        let ZYL = Number(data.zyL);
        let YYL = Number(data.yyL);
        let H = Number(data.H);

        let filterNum: number = 0;

        // 转角点
        let xx: number = data.GMT / sinA + data.GMT / sinA * cosA;
        // 左侧面孔
        holes = [];
        MoldUtils.getGmtHoles(data.p_l_r1, data.p_l_r1dw, holes, 1);
        MoldUtils.getGmtHoles(data.p_l_r2, data.p_l_r2dw, holes, 1);
        MoldUtils.getGmtHoles(data.p_l_r3, data.p_l_r3dw, holes, 1);

        fontp = MoldUtils.getLeftXieVi(0, 0, ZYL, sinA, cosA);
        backp = MoldUtils.getLeftXieVi(data.GMT, data.GMT, ZYL, sinA, cosA);

        backpath = [
            new Vector2(0, 0),
            new Vector2(fontp[2], 0),
            new Vector2(fontp[2], -H + DJXQH),
            new Vector2(0, -H + DJXQH)
        ]
        backface = MoldUtils.getLeftXieFaceVI(0, 0, ZYL, -H + DJXQH, 0, sinA, cosA);

        fontpath = [
            new Vector2(0, 0),
            new Vector2(backp[2], 0),
            new Vector2(backp[2], -H + DJXQH),
            new Vector2(0, -H + DJXQH)
        ]
        frontface = MoldUtils.getLeftXieFaceVI(data.GMT, data.GMT, ZYL, -H + DJXQH, 0, sinA, cosA);

        count = MoldUtils.getLeftHoleVI(count, vertices, indices, facevec, holes, holes, backpath, fontpath, backface, frontface, data.GMT, data.GMT, data.GMT, sinA, cosA);

        // 右侧面孔
        holes = [];
        MoldUtils.getGmtHoles(data.p_r_r1, data.p_r_r1dw, holes, 2);
        MoldUtils.getGmtHoles(data.p_r_r2, data.p_r_r2dw, holes, 2);
        MoldUtils.getGmtHoles(data.p_r_r3, data.p_r_r3dw, holes, 2);

        count = MoldUtils.getRightHoleVI(count, vertices, indices, facevec, holes, 0, xx, YYL, YYL, -H + DJXQH, 0, 0, data.GMT, cosA, sinA, data.BKH, data.BKH);

        // 顶面
        path = MoldUtils.getCornerPath(0, data.BKH, data.BKH, ZYL, YYL, sinA, cosA);

        let zyskk = AModelFmulaUtils.getHolesbyExpress(data.p_szykw, ZYL, 2, data, AK.p_szykw);
        filterNum = 0;
        for (i = 0; i < zyskk.length; i++) {
            xv = zyskk[i] * cosA + (data.BKH - data.BKKJMDis) * sinA;
            yv = zyskk[i] * sinA - (data.BKH - data.BKKJMDis) * cosA;
            // 过滤孔
            if (zyskk[i] > ZYL - data.BKDia / 2 || zyskk[i] < minRX + data.BKDia / 2) {
                filterNum++;
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_szykw, ZYL, 2, data, AK.p_szykw, filterNum);

        // 右翼
        let yyskk = AModelFmulaUtils.getHolesbyExpress(data.p_syykw, YYL, 2, data, AK.p_syykw);
        filterNum = 0;
        for (i = 0; i < yyskk.length; i++) {
            xv = yyskk[i];
            yv = (data.BKH - data.BKKJMDis);

            // 过滤孔
            if (xv > YYL - data.BKDia / 2 || xv < minRX + data.BKDia / 2) {
                filterNum++;
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_syykw, YYL, 2, data, AK.p_syykw, filterNum);

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, 0, -data.GMT, false);

        // 底
        path = MoldUtils.getCornerPath(DJXQW, data.BKH, data.BKH, ZYL, YYL, sinA, cosA);
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, -H + data.GMT, -H, false);

        // 斜封
        count = MoldUtils.getXieFenVI(count, vertices, indices, facevec, ZYL, YYL, H, data.GMT, cosA, sinA, DJXQW, DJXQH);


        // 左封
        path = [
            new Vector2(0, 0),
            new Vector2(0, -H + DJXQH),
            new Vector2(DJXQW, -H),
            new Vector2(data.BKH, -H),
            new Vector2(data.BKH, 0)
        ];
        backface = [
            new Vector3(ZYL * cosA, 0, ZYL * sinA),
            new Vector3(ZYL * cosA, -H + DJXQH, ZYL * sinA),
            new Vector3(ZYL * cosA + DJXQW * sinA, -H, ZYL * sinA - DJXQH * cosA),
            new Vector3(ZYL * cosA + data.BKH * sinA, -H, ZYL * sinA - data.BKH * cosA),
            new Vector3(ZYL * cosA + data.BKH * sinA, 0, ZYL * sinA - data.BKH * cosA)
        ];
        frontface = [
            new Vector3((ZYL - data.bkT) * cosA, 0, (ZYL - data.bkT) * sinA),
            new Vector3((ZYL - data.bkT) * cosA, -H + DJXQH, (ZYL - data.bkT) * sinA),
            new Vector3((ZYL - data.bkT) * cosA + DJXQW * sinA, -H, (ZYL - data.bkT) * sinA - DJXQH * cosA),
            new Vector3((ZYL - data.bkT) * cosA + data.BKH * sinA, -H, (ZYL - data.bkT) * sinA - data.BKH * cosA),
            new Vector3((ZYL - data.bkT) * cosA + data.BKH * sinA, 0, (ZYL - data.bkT) * sinA - data.BKH * cosA)
        ];

        holes = [];
        // 封板平孔
        let zfkw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, H, 2, data, AK.p_zkkw);
        // 封板竖孔
        for (i = 0; i < zfkw.length; i++) {
            xv = (data.BKH - data.BKKJMDis);
            yv = -zfkw[i];

            let inPolygon = MoldUtils.inPolygon(new Vector2(xv, yv), path, data.BKDia / 2);
            if (inPolygon) {
                inPolygon = MoldUtils.checkPointPolygon(path, new Vector2(xv, yv));
            }
            if (!inPolygon) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        count = MoldUtils.getFengVI(count, vertices, indices, facevec, ZYL, data.bkT, cosA, sinA, backface, frontface, path, holes);

        // 右封
        path = [
            new Vector2(0, 0),
            new Vector2(0, data.BKH),
            new Vector2(-H, data.BKH),
            new Vector2(-H, DJXQW),
            new Vector2(-H + DJXQH, 0)
        ];
        let yfkw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, H, 2, data, AK.p_ykkw);
        holes = [];

        // 封板竖孔
        for (i = 0; i < yfkw.length; i++) {
            xv = -yfkw[i];
            yv = (data.BKH - data.BKKJMDis);

            let inPolygon = MoldUtils.inPolygon(new Vector2(xv, yv), path, data.BKDia / 2);
            if (inPolygon) {
                inPolygon = MoldUtils.checkPointPolygon(path, new Vector2(xv, yv));
            }
            if (!inPolygon) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, YYL, YYL - data.bkT, true);


        return [vertices, indices, facevec];
    }

    /**
     * 截面异形C槽
     * @param data 
     * @returns 
     */
    static getSectionSlotVI(data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let filterNum: number = 0;

        let radian = data.p_jiajiao / 180 * Math.PI;
        let cosA = Math.cos(radian);
        let sinA = Math.sin(radian);

        // 过滤
        let radianBan = data.p_jiajiao / 2 / 180 * Math.PI;
        let tanC = Math.tan(radianBan);
        let minRX = data.BKH / tanC;

        // 内外斜
        let xierad = data.XBNXJD / 180 * Math.PI;
        let tanX = Math.tan(xierad);

        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        let xv: number, yv: number, i: number;
        let backface: Vector3[], frontface: Vector3[];

        // 基础数据
        let ZYL = Number(data.zyL);
        let YYL = Number(data.yyL);
        let W = Number(data.W);

        let leftdis = data.p_zksctype === 1 ? -(data.BKH + data.pkH) / tanX : data.p_zksctype === 2 ? (data.BKH + data.pkH) / tanX : 0;
        let rightdis = data.p_yksctype === 1 ? -(data.BKH + data.pkH) / tanX : data.p_yksctype === 2 ? (data.BKH + data.pkH) / tanX : 0;
        let pkbl = data.pkH / (data.BKH + data.pkH);
        // 顶
        path = MoldUtils.getCornerPath(0, data.BKH, data.BKH, ZYL, YYL, sinA, cosA, true);

        path[1].x += pkbl * leftdis * cosA;
        path[1].y -= pkbl * leftdis * sinA;

        path[2].x += leftdis * cosA;
        path[2].y -= leftdis * sinA;

        path[4].x += rightdis;
        path[5].x += pkbl * rightdis;

        holes = [];
        let szykw = AModelFmulaUtils.getHolesbyExpress(data.p_szykw, ZYL, 2, data, AK.p_szykw);
        filterNum = 0;
        for (i = 0; i < szykw.length; i++) {
            xv = szykw[i] * cosA + (data.BKH - data.BKKJMDis) * sinA;
            yv = -szykw[i] * sinA + (data.BKH - data.BKKJMDis) * cosA;

            if (szykw[i] > ZYL - data.BKDia / 2 || szykw[i] < minRX + data.BKDia / 2) {
                filterNum++;
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_szykw, ZYL, 2, data, AK.p_szykw, filterNum);

        let syykw = AModelFmulaUtils.getHolesbyExpress(data.p_syykw, YYL, 2, data, AK.p_syykw);
        filterNum = 0;
        for (i = 0; i < syykw.length; i++) {
            xv = syykw[i];
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > YYL - data.BKDia / 2 || xv < minRX + data.BKDia / 2) {
                filterNum++;
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_syykw, YYL, 2, data, AK.p_syykw, filterNum);
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, -data.bkT, 0, true);

        // 底
        path = MoldUtils.getCornerPath(-data.pkH, data.BKH, data.BKH, ZYL, YYL, sinA, cosA, true);

        path[2].x += leftdis * cosA;
        path[2].y -= leftdis * sinA;

        path[4].x += rightdis;

        holes = [];
        let xzykw = AModelFmulaUtils.getHolesbyExpress(data.p_xzykw, ZYL, 2, data, AK.p_xzykw);
        filterNum = 0;
        for (i = 0; i < xzykw.length; i++) {
            xv = xzykw[i] * cosA + (data.BKH - data.BKKJMDis) * sinA;
            yv = -xzykw[i] * sinA + (data.BKH - data.BKKJMDis) * cosA;

            if (xzykw[i] > ZYL - data.BKDia / 2 || xzykw[i] < minRX + data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_xzykw, ZYL, 2, data, AK.p_xzykw, filterNum);

        let xyykw = AModelFmulaUtils.getHolesbyExpress(data.p_xyykw, YYL, 2, data, AK.p_xyykw);
        filterNum = 0;
        for (i = 0; i < xyykw.length; i++) {
            xv = xyykw[i];
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > YYL - data.BKDia / 2 || xv < minRX + data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        AModelFmulaUtils.getHolesbyExpress(data.p_xyykw, YYL, 2, data, AK.p_xyykw, filterNum);
        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 2, -W, -W + data.bkT, true);

        // 下背
        let xbbl = data.GMT / (data.BKH + data.pkH);

        path = MoldUtils.getCornerPath(-data.pkH, -data.pkH + data.GMT, -data.pkH + data.GMT, ZYL, YYL, sinA, cosA, true);

        path[2].x += xbbl * leftdis * cosA;
        path[2].y -= xbbl * leftdis * sinA;

        path[4].x += xbbl * rightdis;

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, -W, -data.pkW - data.qkW, true);

        // 上背
        let sbbl = (data.pkH + data.GMT) / (data.BKH + data.pkH);
        path = MoldUtils.getCornerPath(0, data.GMT, data.GMT, ZYL, YYL, sinA, cosA, true);
        path[1].x += pkbl * leftdis * cosA;
        path[1].y -= pkbl * leftdis * sinA;

        path[2].x += sbbl * leftdis * cosA;
        path[2].y -= sbbl * leftdis * sinA;

        path[4].x += sbbl * rightdis;
        path[5].x += pkbl * rightdis;

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, -data.qkW, 0, true);

        // 斜
        let yoffset = pkbl * rightdis;
        let zoffset = pkbl * leftdis;

        // 斜面
        let xy = MoldUtils.getXY(data.pkW, data.pkH, data.GMT);
        let xf = xy[0];
        let yf = xy[1];

        let xone = (data.pkH + yf) / (data.pkH + data.BKH);
        let xtwo = yf / (data.pkH + data.BKH);

        let yoffset2 = xone * rightdis;
        let yoffset3 = xtwo * rightdis;
        let zoffset2 = xone * leftdis;
        let zoffset3 = xtwo * leftdis;

        let offset: number[] = [zoffset, zoffset2, zoffset3, yoffset, yoffset2, yoffset3]
        count = MoldUtils.getXieFenVI3(count, vertices, indices, facevec, cosA, sinA, ZYL, YYL, data.GMT, data.qkW, data.pkW, data.pkH, xf, yf, offset);


        // 左封
        path = [
            new Vector2(0, 0),
            new Vector2(data.BKH, 0),
            new Vector2(data.BKH, -W),
            new Vector2(-data.pkH, -W),
            new Vector2(-data.pkH, -data.qkW - data.pkW),
            new Vector2(0, -data.qkW)
        ]

        backface = [
            new Vector3((ZYL + pkbl * leftdis) * cosA, 0, -(ZYL + pkbl * leftdis) * sinA),
            new Vector3((ZYL + leftdis) * cosA + data.BKH * sinA, 0, -(ZYL + leftdis) * sinA + data.BKH * cosA),
            new Vector3((ZYL + leftdis) * cosA + data.BKH * sinA, -W, -(ZYL + leftdis) * sinA + data.BKH * cosA),
            new Vector3(ZYL * cosA - data.pkH * sinA, -W, -ZYL * sinA - data.pkH * cosA),
            new Vector3(ZYL * cosA - data.pkH * sinA, -data.qkW - data.pkW, -ZYL * sinA - data.pkH * cosA),
            new Vector3((ZYL + pkbl * leftdis) * cosA, -data.qkW, -(ZYL + pkbl * leftdis) * sinA)
        ]

        frontface = [
            new Vector3((ZYL - data.fbH + pkbl * leftdis) * cosA, 0, -(ZYL - data.fbH + pkbl * leftdis) * sinA),
            new Vector3((ZYL - data.fbH + leftdis) * cosA + data.BKH * sinA, 0, -(ZYL - data.fbH + leftdis) * sinA + data.BKH * cosA),
            new Vector3((ZYL - data.fbH + leftdis) * cosA + data.BKH * sinA, -W, -(ZYL - data.fbH + leftdis) * sinA + data.BKH * cosA),
            new Vector3((ZYL - data.fbH) * cosA - data.pkH * sinA, -W, -(ZYL - data.fbH) * sinA - data.pkH * cosA),
            new Vector3((ZYL - data.fbH) * cosA - data.pkH * sinA, -data.qkW - data.pkW, -(ZYL - data.fbH) * sinA - data.pkH * cosA),
            new Vector3((ZYL - data.fbH + pkbl * leftdis) * cosA, -data.qkW, -(ZYL - data.fbH + pkbl * leftdis) * sinA)
        ]

        holes = [];
        let zkkw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, W, 2, data, AK.p_zkkw);
        // 封板竖孔
        for (i = 0; i < zkkw.length; i++) {
            xv = (data.BKH - data.BKKJMDis);
            yv = -zkkw[i];

            if (yv < -W + data.BKDia / 2 || yv > -data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }
        // count = MoldUtils.getFengVI(count, vertices, indices, facevec, ZYL, data.fbH, cosA, sinA, backface, frontface, path, holes, 2, true);

        let topvec = frontface.concat(frontface[0].clone());
        let bottomvec = backface.concat(backface[0].clone());

        // 侧边
        let side = MoldUtils.getSideVIF(topvec, bottomvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 形状
        let shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        let geometry = new ShapeGeometry(shape);
        let positionAry = geometry.attributes.position;
        let indexAry = geometry.getIndex();

        // 顶点
        let vertex: any[] = []
        let index: any[] = [];

        let len: number = data.BKH + data.pkH;

        let cx = leftdis * cosA;
        let cy = leftdis * sinA;
        let x: number, z: number;
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];


            x = a * sinA + ZYL * cosA + (a + data.pkH) / len * cx;
            z = a * cosA - ZYL * sinA - (a + data.pkH) / len * cy;

            vertex.push(x, b, z);
        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse()
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(frontface.concat());

        count = Math.max(...indices) + 1;

        vertex = [];
        index = [];
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            x = a * sinA + (ZYL - data.fbH) * cosA + (a + data.pkH) / len * cx;
            z = a * cosA - (ZYL - data.fbH) * sinA - (a + data.pkH) / len * cy;

            vertex.push(x, b, z);

        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        // index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(backface.concat());

        count = Math.max(...indices) + 1;


        // 右封
        path = [
            new Vector2(0, 0),
            new Vector2(-data.qkW, 0),
            new Vector2(-data.qkW - data.pkW, data.pkH),
            new Vector2(-W, data.pkH),
            new Vector2(-W, -data.BKH),
            new Vector2(0, -data.BKH)
        ]

        holes = [];
        let ykkw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, W, 2, data, AK.p_ykkw);
        // 封板竖孔
        for (i = 0; i < ykkw.length; i++) {
            xv = -ykkw[i];
            yv = -(data.BKH - data.BKKJMDis);

            if (xv < -W + data.BKDia / 2 || xv > -data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);
        }

        let zxie = data.p_yksctype === 1 ? - (data.BKH + data.pkH) / tanX :
            data.p_yksctype === 2 ? (data.BKH + data.pkH) / tanX : 0;

        let zxiebl = data.pkH / (data.BKH + data.pkH) * zxie;
        frontface = [
            new Vector3(YYL + zxiebl, 0, 0),
            new Vector3(YYL + zxiebl, -data.qkW, 0),
            new Vector3(YYL, -data.qkW - data.pkW, data.pkH),
            new Vector3(YYL, -W, data.pkH),
            new Vector3(YYL + zxie, -W, -data.BKH),
            new Vector3(YYL + zxie, 0, -data.BKH)
        ]

        backface = [
            new Vector3((YYL - data.fbH + zxiebl), 0, 0),
            new Vector3((YYL - data.fbH + zxiebl), -data.qkW, 0),
            new Vector3((YYL - data.fbH), -data.qkW - data.pkW, data.pkH),
            new Vector3((YYL - data.fbH), -W, data.pkH),
            new Vector3((YYL - data.fbH + zxie), -W, -data.BKH),
            new Vector3((YYL - data.fbH + zxie), 0, -data.BKH)
        ]

        topvec = frontface.concat(frontface[0].clone());
        bottomvec = backface.concat(backface[0].clone());

        // 侧边
        side = MoldUtils.getSideVIF(bottomvec, topvec, count);
        vertices.push(...side[0]);
        indices.push(...side[1]);
        facevec.push(...side[2]);
        count = side[3];

        // 形状
        shape = new Shape().setFromPoints(path);
        // 挖孔
        if (holes && holes.length > 0) {
            shape.holes.push(...holes);
        }

        geometry = new ShapeGeometry(shape);
        positionAry = geometry.attributes.position;
        indexAry = geometry.getIndex();

        let a: number, b: number, c: number;
        // 顶点
        vertex = []
        index = [];
        for (i = 0; i < positionAry.array.length; i += 3) {

            a = positionAry.array[i];
            b = positionAry.array[i + 1];
            c = positionAry.array[i + 2];


            x = YYL - (b - data.pkH) / (data.BKH + data.pkH) * zxie;

            vertex.push(x, a, b);
        }

        // 索引
        for (i = 0; i < indexAry.array.length; i += 3) {
            a = indexAry.array[i] + count;
            b = indexAry.array[i + 1] + count;
            c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        // index.reverse()
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(frontface.concat());

        count = Math.max(...indices) + 1;

        vertex = [];
        index = [];
        for (let i = 0; i < positionAry.array.length; i += 3) {

            let a = positionAry.array[i];
            let b = positionAry.array[i + 1];
            let c = positionAry.array[i + 2];

            x = YYL - data.fbH - (b - data.pkH) / (data.BKH + data.pkH) * zxie;

            vertex.push(x, a, b);

        }

        // 索引
        for (let i = 0; i < indexAry.array.length; i += 3) {
            let a = indexAry.array[i] + count;
            let b = indexAry.array[i + 1] + count;
            let c = indexAry.array[i + 2] + count;

            index.push(a, b, c);
        }

        index.reverse();
        vertices.push(...vertex);
        indices.push(...index);
        facevec.push(backface.concat());

        count = Math.max(...indices) + 1;


        return [vertices, indices, facevec];
    }


    static getSectionShapeXieqie(top: boolean, type: number, tanA: number, pkW: number, pkH: number, BKH: number, GMT: number) {

        let one: number, two: number, three: number, four: number, five: number, six: number;

        let sone: number, stwo: number, sthree: number, sfour: number, sfive: number;
        let eone: number, etwo: number, ethree: number, efour: number, efive: number;

        let heng = pkH + BKH
        let su = heng / tanA;
        let pkwhd = MoldUtils.SqrtValue(pkW, pkH);
        let xx = pkW * GMT / pkwhd;

        if (type === 1) {
            // 内斜
            one = -su;
            two = 0;
            three = 0;
            four = -pkH / heng * su;
            five = -pkH / heng * su
            six = -su;

            sone = -su;
            eone = 0;

            stwo = -GMT / heng * su;
            etwo = -GMT / heng * su;

            sthree = -xx / heng * su;
            ethree = (-pkH - xx) / heng * su;

            sfour = -(pkH + GMT) / heng * su;
            efour = -(pkH + GMT) / heng * su;

            sfive = -pkH / heng * su;
            efive = -su;

        }
        else if (type === 2) {
            // 外斜
            one = su;
            two = 0;
            three = 0;
            four = pkH / heng * su;
            five = pkH / heng * su
            six = su;

            sone = su;
            eone = 0;

            stwo = GMT / heng * su;
            etwo = GMT / heng * su;

            sthree = xx / heng * su;
            ethree = (pkH + xx) / heng * su;

            sfour = (pkH + GMT) / heng * su;
            efour = (pkH + GMT) / heng * su;

            sfive = pkH / heng * su;
            efive = su;
        }
        else {
            one = 0;
            two = 0;
            three = 0;
            four = 0;
            five = 0
            six = 0;

            sone = 0;
            eone = 0;

            stwo = 0;
            etwo = 0;

            sthree = 0;
            ethree = 0;

            sfour = 0;
            efour = 0;

            sfive = 0;
            efive = 0;
        }

        return top ? [one, two, three, four, five, six, sone, stwo, sthree, sfour, sfive, eone, etwo, ethree, efour, efive] :
            [-one, -two, -three, -four, -five, -six, -sone, -stwo, -sthree, -sfour, -sfive, -eone, -etwo, -ethree, -efour, -efive];
    }


    /**
     * 截面异形平板
     * @param data 
     * @returns 
     */
    static getSectionShapeVI(data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let L: number = Number(data.L);
        let W: number = Number(data.W);

        let DJXQW: number = Number(data.DJXQW);
        let DJXQH: number = Number(data.DJXQH);

        let pkH = Number(data.pkH);
        let pkW = Number(data.pkW);
        let qkW = W - Number(data.qkW);

        data.duan = [
            0, 0, 0,
            L, 0, 0,
            0, pkH, -W,
            L, pkH, -W
        ]

        data.zhong = {
            L: [
                {
                    pointer: [L, pkH, -W / 2],
                    center: [L / 2, pkH, -W / 2],
                    dir: [L, pkH, -W]
                },
            ],
            RL: [
                {
                    pointer: [0, pkH, -W / 2,],
                    center: [L / 2, pkH, -W / 2],
                    dir: [0, pkH, -W]
                },
            ]

        }

        // 边框孔中心点
        let minx = data.p_ddjsc === 1 ? -DJXQH : 0;
        let maxx = data.p_ddjsc === 2 ? DJXQH : 0;

        let radian = data.XBNXJD / 180 * Math.PI;
        let tanA = Math.tan(radian);
        let sinA = Math.sin(radian);
        let cosA = Math.cos(radian);

        let topXie = MoldUtils.getSectionShapeXieqie(true, data.p_sksctype, tanA, pkW, pkH, data.BKH, data.GMT);
        let bottomXie = MoldUtils.getSectionShapeXieqie(false, data.p_xksctype, tanA, pkW, pkH, data.BKH, data.GMT);

        let path: Vector2[], backPath: Vector2[], frontPath: Vector2[];;
        let holes: Path[];
        let holePath: Path;
        let xv: number, yv: number, i: number;
        let backface: Vector3[], frontface: Vector3[];
        let topvec: Vector3[], bottomvec: Vector3[];
        let side: any[];

        if (data.p_dripLinetype === 1) {

            let txdsxtopL = data.txdsx_topL;
            let txdsxbottomL = data.txdsx_bottomL;
            let txdsxH = data.txdsx_H;
            let dsxbj = data.dsxbj;

            let btdv = (txdsxbottomL - txdsxtopL) / 2;
            let topPath = [
                new Vector2(minx, -W + dsxbj + btdv),
                new Vector2(minx, -W + dsxbj + txdsxbottomL - btdv),
                new Vector2(L + maxx, -W + dsxbj + txdsxbottomL - btdv),
                new Vector2(L + maxx, -W + dsxbj + btdv)
            ]

            let bottomPath = [
                new Vector2(minx, -W + dsxbj),
                new Vector2(minx, -W + dsxbj + txdsxbottomL),
                new Vector2(L + maxx, -W + dsxbj + txdsxbottomL),
                new Vector2(L + maxx, -W + dsxbj)
            ]

            count = MoldUtils.getDripLineVI(count, vertices, indices, facevec, topPath, bottomPath, pkH, pkH + txdsxH);
        }

        if (pkH <= 0) {
            backPath = data.p_ddjsc === 1 ? [
                new Vector2(minx, -W),
                new Vector2(minx, 0),
                new Vector2(L + maxx + topXie[4], 0),
                new Vector2(L + maxx + topXie[3], -W)
            ] : data.p_ddjsc === 2 ? [
                new Vector2(minx + bottomXie[3], -W),
                new Vector2(minx + bottomXie[4], 0),
                new Vector2(L + maxx, 0),
                new Vector2(L + maxx, -W)
            ] : [
                new Vector2(minx + bottomXie[3], -W),
                new Vector2(minx + bottomXie[4], 0),
                new Vector2(L + maxx + maxx + topXie[4], 0),
                new Vector2(L + maxx + topXie[3], -W)
            ];
            frontPath = data.p_ddjsc === 1 ? [
                new Vector2(minx, -W),
                new Vector2(minx, 0),
                new Vector2(L + maxx + topXie[14], 0),
                new Vector2(L + maxx + topXie[9], -W)
            ] : data.p_ddjsc === 2 ? [
                new Vector2(minx + bottomXie[9], -W),
                new Vector2(minx + bottomXie[14], 0),
                new Vector2(L + maxx, 0),
                new Vector2(L + maxx, -W)
            ] : [
                new Vector2(minx + bottomXie[9], -W),
                new Vector2(minx + bottomXie[14], 0),
                new Vector2(L + maxx + topXie[14], 0),
                new Vector2(L + maxx + topXie[9], -W)
            ];
            count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, null, 2, 0, -data.GMT, false, false);
        }
        else {
            // 顶后
            backPath = data.p_ddjsc === 1 ? [
                new Vector2(minx, -W),
                new Vector2(minx, - pkW - qkW),
                new Vector2(L + topXie[2], - pkW - qkW),
                new Vector2(L + topXie[1], -W)
            ] : data.p_ddjsc === 2 ? [
                new Vector2(minx + bottomXie[1], -W),
                new Vector2(minx + bottomXie[2], - pkW - qkW),
                new Vector2(L + maxx, - pkW - qkW),
                new Vector2(L + maxx, -W)
            ] : [
                new Vector2(minx + bottomXie[1], -W),
                new Vector2(minx + bottomXie[2], - pkW - qkW),
                new Vector2(L + topXie[2], - pkW - qkW),
                new Vector2(L + topXie[1], -W)
            ];
            frontPath = data.p_ddjsc === 1 ? [
                new Vector2(minx, -W),
                new Vector2(minx, -pkW - qkW),
                new Vector2(L + topXie[12], -pkW - qkW),
                new Vector2(L + topXie[7], -W)
            ] : data.p_ddjsc === 2 ? [
                new Vector2(minx + bottomXie[7], -W),
                new Vector2(minx + bottomXie[12], -pkW - qkW),
                new Vector2(L + maxx, -pkW - qkW),
                new Vector2(L + maxx, -W)
            ] : [
                new Vector2(minx + bottomXie[7], -W),
                new Vector2(minx + bottomXie[12], -pkW - qkW),
                new Vector2(L + topXie[12], -pkW - qkW),
                new Vector2(L + topXie[7], -W)
            ];
            count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, null, 2, pkH, pkH - data.GMT, false, false);

            // 顶前
            backPath = data.p_ddjsc === 1 ? [
                new Vector2(minx, -qkW),
                new Vector2(minx, 0),
                new Vector2(L + topXie[4], 0),
                new Vector2(L + topXie[3], -qkW)
            ] : data.p_ddjsc === 2 ? [
                new Vector2(minx + bottomXie[3], -qkW),
                new Vector2(minx + bottomXie[4], 0),
                new Vector2(L + maxx, 0),
                new Vector2(L + maxx, -qkW)
            ] : [
                new Vector2(minx + bottomXie[3], -qkW),
                new Vector2(minx + bottomXie[4], 0),
                new Vector2(L + topXie[4], 0),
                new Vector2(L + topXie[3], -qkW)
            ];
            frontPath = data.p_ddjsc === 1 ? [
                new Vector2(minx, -qkW),
                new Vector2(minx, 0),
                new Vector2(L + topXie[14], 0),
                new Vector2(L + topXie[9], -qkW)
            ] : data.p_ddjsc === 2 ? [
                new Vector2(minx + bottomXie[9], -qkW),
                new Vector2(minx + bottomXie[14], 0),
                new Vector2(L + maxx, 0),
                new Vector2(L + maxx, -qkW)
            ] : [
                new Vector2(minx + bottomXie[9], -qkW),
                new Vector2(minx + bottomXie[14], 0),
                new Vector2(L + topXie[14], 0),
                new Vector2(L + topXie[9], -qkW)
            ];
            count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, null, 2, 0, -data.GMT, false, false);

            // 顶斜
            let xy = MoldUtils.getXY(pkH, pkW, data.GMT);
            let x = xy[0];
            let y = xy[1];

            backface = data.p_ddjsc === 1 ? [
                new Vector3(minx, pkH, -qkW - pkW),
                new Vector3(minx, 0, -qkW),
                new Vector3(L + topXie[3], 0, -qkW),
                new Vector3(L + topXie[2], pkH, -qkW - pkW)
            ] : data.p_ddjsc === 2 ? [
                new Vector3(minx + bottomXie[2], pkH, -qkW - pkW),
                new Vector3(minx + bottomXie[3], 0, -qkW),
                new Vector3(L + maxx, 0, -qkW),
                new Vector3(L + maxx, pkH, -qkW - pkW)
            ] : [
                new Vector3(minx + bottomXie[2], pkH, -qkW - pkW),
                new Vector3(minx + bottomXie[3], 0, -qkW),
                new Vector3(L + topXie[3], 0, -qkW),
                new Vector3(L + topXie[2], pkH, -qkW - pkW)
            ];
            frontface = data.p_ddjsc === 1 ? [
                new Vector3(minx, pkH - x, -qkW - pkW - y),
                new Vector3(minx, 0 - x, -qkW - y),
                new Vector3(L + topXie[13], 0 - x, -qkW - y),
                new Vector3(L + topXie[8], pkH - x, -qkW - pkW - y)
            ] : data.p_ddjsc === 2 ? [
                new Vector3(minx + bottomXie[8], pkH - x, -qkW - pkW - y),
                new Vector3(minx + bottomXie[13], 0 - x, -qkW - y),
                new Vector3(L + maxx, 0 - x, -qkW - y),
                new Vector3(L + maxx, pkH - x, -qkW - pkW - y)
            ] : [
                new Vector3(minx + bottomXie[8], pkH - x, -qkW - pkW - y),
                new Vector3(minx + bottomXie[13], 0 - x, -qkW - y),
                new Vector3(L + topXie[13], 0 - x, -qkW - y),
                new Vector3(L + topXie[8], pkH - x, -qkW - pkW - y)
            ];
            topvec = frontface.concat(frontface[0].clone());
            bottomvec = backface.concat(backface[0].clone());
            // 侧边
            side = MoldUtils.getVIF(topvec, bottomvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];
        }


        // 右侧
        let ykkw = AModelFmulaUtils.getHolesbyExpress(data.p_ykkw, L, 2, data, AK.p_ykkw);
        holes = [];

        for (i = 0; i < ykkw.length; i++) {
            xv = ykkw[i];
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > L - data.BKDia / 2) {
                continue;
            }

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);

        }


        backPath = data.p_ddjsc === 1 ? [
            new Vector2(-DJXQH, 0),
            new Vector2(-DJXQH, -data.BKH + DJXQW),
            new Vector2(0, -data.BKH),
            new Vector2(L + topXie[5], -data.BKH),
            new Vector2(L + topXie[4], 0)
        ] : data.p_ddjsc === 2 ? [
            new Vector2(bottomXie[4], 0),
            new Vector2(bottomXie[5], -data.BKH),
            new Vector2(L, -data.BKH),
            new Vector2(L + DJXQH, -data.BKH + DJXQW),
            new Vector2(L + DJXQH, 0)
        ] : [
            new Vector2(bottomXie[4], 0),
            new Vector2(bottomXie[5], -data.BKH),
            new Vector2(L + topXie[5], -data.BKH),
            new Vector2(L + topXie[4], 0)
        ];
        frontPath = data.p_ddjsc === 1 ? [
            new Vector2(-DJXQH, 0),
            new Vector2(-DJXQH, -data.BKH + DJXQW),
            new Vector2(0, -data.BKH),
            new Vector2(L + topXie[15], -data.BKH),
            new Vector2(L + topXie[10], 0)
        ] : data.p_ddjsc === 2 ? [
            new Vector2(bottomXie[10], 0),
            new Vector2(bottomXie[15], -data.BKH),
            new Vector2(L, -data.BKH),
            new Vector2(L + DJXQH, -data.BKH + DJXQW),
            new Vector2(L + DJXQH, 0)
        ] : [
            new Vector2(bottomXie[10], 0),
            new Vector2(bottomXie[15], -data.BKH),
            new Vector2(L + topXie[15], -data.BKH),
            new Vector2(L + topXie[10], 0)
        ];
        count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, holes, 0, -data.ZYKH, 0, false, true);

        // 左侧
        let zkkw = AModelFmulaUtils.getHolesbyExpress(data.p_zkkw, L, 2, data, AK.p_zkkw);
        holes = [];

        for (i = 0; i < zkkw.length; i++) {
            xv = zkkw[i];
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > L - data.BKDia / 2) {
                continue;
            }

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);

        }

        backPath = data.p_ddjsc === 1 ? [
            new Vector2(-DJXQH, pkH),
            new Vector2(-DJXQH, -data.BKH + DJXQW),
            new Vector2(0, -data.BKH),
            new Vector2(L + topXie[0], -data.BKH),
            new Vector2(L + topXie[1], pkH)

        ] : data.p_ddjsc === 2 ? [
            new Vector2(bottomXie[1], pkH),
            new Vector2(bottomXie[0], -data.BKH),
            new Vector2(L, -data.BKH),
            new Vector2(L + DJXQH, -data.BKH + DJXQW),
            new Vector2(L + DJXQH, pkH)

        ] : [
            new Vector2(bottomXie[1], pkH),
            new Vector2(bottomXie[0], -data.BKH),
            new Vector2(L + topXie[0], -data.BKH),
            new Vector2(L + topXie[1], pkH)
        ];

        frontPath = data.p_ddjsc === 1 ? [
            new Vector2(-DJXQH, pkH),
            new Vector2(-DJXQH, -data.BKH + DJXQW),
            new Vector2(0, -data.BKH),
            new Vector2(L + topXie[6], -data.BKH),
            new Vector2(L + topXie[11], pkH)

        ] : data.p_ddjsc === 2 ? [
            new Vector2(bottomXie[11], pkH),
            new Vector2(bottomXie[6], -data.BKH),
            new Vector2(L, -data.BKH),
            new Vector2(L + DJXQH, -data.BKH + DJXQW),
            new Vector2(L + DJXQH, pkH)

        ] : [
            new Vector2(bottomXie[11], pkH),
            new Vector2(bottomXie[6], -data.BKH),
            new Vector2(L + topXie[6], -data.BKH),
            new Vector2(L + topXie[11], pkH)
        ];
        count = MoldUtils.getFaceByPaths(count, vertices, indices, facevec, frontPath, backPath, holes, 0, -W, -W + data.ZYKH, false, true);



        // 上下路径
        path = [
            new Vector2(-data.BKH / sinA, -W),
            new Vector2(pkH / sinA, -W),
            new Vector2(pkH / sinA, -qkW - pkW),
            new Vector2(0, -qkW),
            new Vector2(0, 0),
            new Vector2(-data.BKH / sinA, 0)
        ]

        if (data.p_sksctype != 3 && data.p_ddjsc != 2) {
            // 上侧
            let skkw = AModelFmulaUtils.getHolesbyExpress(data.p_skkw, W, 2, data, AK.p_skkw);
            holes = [];

            for (i = 0; i < skkw.length; i++) {
                xv = -(data.BKH - data.BKKJMDis);
                yv = -skkw[i];

                if (yv < -W + data.BKDia / 2) {
                    continue;
                }

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);


            }

            let xiej = data.p_sksctype === 1 ? cosA : data.p_sksctype === 2 ? -cosA : 0;

            backface = [
                new Vector3(L - data.SXKH + topXie[0], -data.BKH, -W),
                new Vector3(L - data.SXKH + topXie[1], pkH, -W),
                new Vector3(L - data.SXKH + topXie[2], pkH, -qkW - pkW),
                new Vector3(L - data.SXKH + topXie[3], 0, -qkW),
                new Vector3(L - data.SXKH + topXie[4], 0, 0),
                new Vector3(L - data.SXKH + topXie[5], -data.BKH, 0)
            ];
            frontface = [
                new Vector3(L + topXie[0], -data.BKH, -W),
                new Vector3(L + topXie[1], pkH, -W),
                new Vector3(L + topXie[2], pkH, -qkW - pkW),
                new Vector3(L + topXie[3], 0, -qkW),
                new Vector3(L + topXie[4], 0, 0),
                new Vector3(L + topXie[5], -data.BKH, 0)
            ];
            topvec = frontface.concat(frontface[0].clone());
            bottomvec = backface.concat(backface[0].clone());
            // 侧边
            side = MoldUtils.getSideVIF(bottomvec, topvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            // 形状
            let shape = new Shape().setFromPoints(path);
            // 挖孔
            if (holes && holes.length > 0) {
                let tmpholes = MoldUtils.getHoleByDivisions(holes);
                shape.holes.push(...tmpholes);
            }
            let geometry = new ShapeGeometry(shape);
            let positionAry = geometry.attributes.position;
            let indexAry = geometry.getIndex();
            // 顶点
            let vertex: any[] = []
            let index: any[] = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(L + a * xiej - pkH * xiej, a * sinA, b);
            }
            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(frontface.concat());
            count = Math.max(...indices) + 1;


            vertex = [];
            index = [];
            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(L - data.SXKH + a * xiej - pkH * xiej, a * sinA, b);
            }

            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }
            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(backface.concat());

            count = Math.max(...indices) + 1
            geometry.dispose();

        }

        // 下侧
        if (data.p_xksctype != 3 && data.p_ddjsc != 1) {
            let xkkw = AModelFmulaUtils.getHolesbyExpress(data.p_xkkw, W, 2, data, AK.p_xkkw);
            holes = [];

            for (i = 0; i < xkkw.length; i++) {
                xv = -(data.BKH - data.BKKJMDis);
                yv = -xkkw[i];

                if (yv < -W + data.BKDia / 2) {
                    continue;
                }

                holePath = new Path();
                holePath.moveTo(xv, yv)
                    .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

                holes.push(holePath);

            }

            let xiej = data.p_xksctype === 1 ? -cosA : data.p_xksctype === 2 ? cosA : 0;

            backface = [
                new Vector3(bottomXie[0], -data.BKH, -W),
                new Vector3(bottomXie[1], pkH, -W),
                new Vector3(bottomXie[2], pkH, -qkW - pkW),
                new Vector3(bottomXie[3], 0, -qkW),
                new Vector3(bottomXie[4], 0, 0),
                new Vector3(bottomXie[5], -data.BKH, 0)
            ];

            frontface = [
                new Vector3(data.SXKH + bottomXie[0], -data.BKH, -W),
                new Vector3(data.SXKH + bottomXie[1], pkH, -W),
                new Vector3(data.SXKH + bottomXie[2], pkH, -qkW - pkW),
                new Vector3(data.SXKH + bottomXie[3], 0, -qkW),
                new Vector3(data.SXKH + bottomXie[4], 0, 0),
                new Vector3(data.SXKH + bottomXie[5], -data.BKH, 0)
            ];
            topvec = frontface.concat(frontface[0].clone());
            bottomvec = backface.concat(backface[0].clone());

            // 侧边
            side = MoldUtils.getSideVIF(bottomvec, topvec, count);
            vertices.push(...side[0]);
            indices.push(...side[1]);
            facevec.push(...side[2]);
            count = side[3];

            // 形状
            let shape = new Shape().setFromPoints(path);
            // 挖孔
            if (holes && holes.length > 0) {
                let tmpholes = MoldUtils.getHoleByDivisions(holes);
                shape.holes.push(...tmpholes);
            }
            let geometry = new ShapeGeometry(shape);
            let positionAry = geometry.attributes.position;
            let indexAry = geometry.getIndex();

            // 顶点
            let vertex: any[] = []
            let index: any[] = [];

            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(a * xiej - pkH * xiej, a * sinA, b);
            }
            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }
            index.reverse();
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(backface.concat());
            count = Math.max(...indices) + 1;


            vertex = [];
            index = [];
            for (let i = 0; i < positionAry.array.length; i += 3) {

                let a = positionAry.array[i];
                let b = positionAry.array[i + 1];
                let c = positionAry.array[i + 2];

                vertex.push(data.SXKH + a * xiej - pkH * xiej, a * sinA, b);
            }
            // 索引
            for (let i = 0; i < indexAry.array.length; i += 3) {
                let a = indexAry.array[i] + count;
                let b = indexAry.array[i + 1] + count;
                let c = indexAry.array[i + 2] + count;

                index.push(a, b, c);
            }
            vertices.push(...vertex);
            indices.push(...index);
            facevec.push(frontface.concat());
            count = Math.max(...indices) + 1

            geometry.dispose();

        }

        // 横肋
        let hldw = AModelFmulaUtils.getHolesbyExpress(data.p_hldw, L, 2, data, AK.p_hldw);
        if (hldw && hldw.length > 0) {
            path = [
                new Vector2(data.pkH - data.GMT, -W + data.ZYKH),
                new Vector2(-data.BKH, -W + data.ZYKH),
                new Vector2(-data.BKH, -data.ZYKH),
                new Vector2(-data.GMT, -data.ZYKH),
                new Vector2(-data.GMT, -W + data.qkW),
                new Vector2(data.pkH - data.GMT, -W + data.qkW - data.pkW)
            ]
            let pos: number;
            let jiajin = data.p_ddjsc === 2 ? L - data.HLW / 2 : data.p_ddjsc === 1 ? data.HLW / 2 : -1;
            if (jiajin !== -1) {
                hldw.push(jiajin)
            }
            for (i = 0; i < hldw.length; i++) {
                pos = hldw[i];
                // if (pos > L) {
                //     continue;
                // }
                count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 1, pos - data.HLW / 2, pos + data.HLW / 2, false);
            }
        }

        // 支撑
        // let cxdw = data.p_cxdw.split(',');

        // let miny = -data.zcgL + pkH - data.GMT;
        // let maxy = pkH - data.GMT;

        // let p_cxdw: number = 0;
        // // 支撑
        // if (data.p_zcsl === 1) {
        //     p_cxdw = Number(cxdw[0]);
        //     if(p_cxdw <= 0){
        //         data.p_cxdw = (L / 2).toFixed(2);
        //         p_cxdw = L / 2;
        //     }
        //     count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, -W / 2, data.ZCGdia, miny, maxy);
        // }
        // else if (data.p_zcsl === 2) {
        //     p_cxdw = Number(cxdw[0]);

        //     if (Number(cxdw[1]) > 0) {
        //         p_cxdw = Number(cxdw[0]);

        //         count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, -W / 2, data.ZCGdia, miny, maxy);

        //         p_cxdw = Number(cxdw[1]) + Number(cxdw[0]);
        //         count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, p_cxdw, -W / 2, data.ZCGdia, miny, maxy);
        //     }
        //     else {
        //         data.p_cxdw = (L * 1 / 3).toFixed(2) + ',' + (L * 1 / 3).toFixed(2);

        //         count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 1 / 3, -W / 2, data.ZCGdia, miny, maxy);

        //         count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, L * 2 / 3, -W / 2, data.ZCGdia, miny, maxy);
        //     }
        // }
        // else {
        //     // 横肋
        //     let hldw = AModelFmulaUtils.getHolesbyExpress(data.p_hldw, L, 2, data, AK.p_hldw);
        //     if (hldw && hldw.length > 0) {
        //         path = [
        //             new Vector2(pkH - data.GMT, -W + data.ZYKH),
        //             new Vector2(-data.BKH, -W + data.ZYKH),
        //             new Vector2(-data.BKH, -data.ZYKH),
        //             new Vector2(-data.GMT, -data.ZYKH),
        //             new Vector2(-data.GMT, -qkW),
        //             new Vector2(pkH - data.GMT, -qkW - pkW)
        //         ]
        //         let pos: number;
        //         for (i = 0; i < hldw.length; i++) {
        //             pos = hldw[i];
        //             if (pos > L - data.GMT) {
        //                 continue;
        //             }
        //             count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 1, pos - data.HLW / 2, pos + data.HLW / 2, false);
        //         }
        //     }
        // }

        return [vertices, indices, facevec];
    }

    /**
     * L形截面异形平板
     * @param data 
     * @returns 
     */
    static getSectionLShapeVI(data: ALParams): any[] {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];
        // 计数
        let count: number = 0;

        let angle = (data.p_jiajiao !== 0 && data.p_jiajiao % 180 === 0) ? data.p_jiajiao - 0.001 : data.p_jiajiao;
        let radian = angle / 180 * Math.PI;
        let cosA = Math.cos(radian);
        let sinA = Math.sin(radian);

        let path: Vector2[];
        let holes: Path[], bholes: Path[], fholes: Path[];
        let holePath: Path;

        let xv: number, yv: number, i: number;
        let backface: Vector3[], frontface: Vector3[];
        let backpath: Vector2[], fontpath: Vector2[];
        let fontp: any[], backp: any[];

        let ZYL = Number(data.zyL);
        let YYL = Number(data.yyL);
        let W = Number(data.W);

        let pkH = Number(data.pkH);
        let pkW = Number(data.pkW);
        let qkW = W - Number(data.qkW);

        if (ZYL <= W) {
            ZYL = W + 0.01;
            data.zyL = W;
        }

        if (YYL <= W) {
            YYL = W + 0.01;
            data.yyL = W;
        }


        let tpath = MoldUtils.getCornerPath(0, W, W, ZYL, YYL, sinA, cosA);;

        let two = tpath[1];
        let three = tpath[2];
        let cenp = tpath[3];
        let zc = two.clone().add(three).multiplyScalar(0.5)
        let four = tpath[4];
        let five = tpath[5];
        let yc = four.clone().add(five).multiplyScalar(0.5);

        let vpath = MoldUtils.getCornerPath(0, W / 2, W / 2, ZYL, YYL, sinA, cosA);;

        data.duan = [
            0, pkH, 0,
            two.x, pkH, two.y,
            three.x, 0, three.y,
            cenp.x, 0, cenp.y,
            four.x, 0, four.y,
            five.x, pkH, five.y
        ]

        data.zhong = {
            zyL: [
                {
                    pointer: [zc.x, pkH, zc.y],
                    center: [vpath[3].x, pkH, vpath[3].y],
                    dir: [two.x, pkH, two.y]
                }
            ],
            yyL: [
                {
                    pointer: [yc.x, pkH, yc.y],
                    center: [vpath[3].x, pkH, vpath[3].y],
                    dir: [five.x, pkH, five.y]
                }

            ]
        }

        // 边框孔中心点

        if (data.p_dripLinetype === 1) {

            let txdsxtopL = data.txdsx_topL;
            let txdsxbottomL = data.txdsx_bottomL;
            let txdsxH = data.txdsx_H;
            let dsxbj = data.dsxbj;

            let btdv = (txdsxbottomL - txdsxtopL) / 2;

            let bottomPath = MoldUtils.getCornerPath(dsxbj, dsxbj + txdsxbottomL, dsxbj + txdsxbottomL, ZYL, YYL, sinA, cosA);

            let topPath = MoldUtils.getCornerPath(dsxbj + btdv, dsxbj + btdv + txdsxtopL, dsxbj + btdv + txdsxtopL, ZYL, YYL, sinA, cosA);

            count = MoldUtils.getDripLineVI(count, vertices, indices, facevec, topPath, bottomPath, pkH, pkH + txdsxH);
        }


        if (pkH <= 0) {
            // 顶左
            path = MoldUtils.getCornerPath(0, W, W, ZYL, YYL, sinA, cosA);

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, 0, - data.GMT, false);
        }
        else {
            // 顶左
            path = MoldUtils.getCornerPath(0, W - qkW - pkW, W - qkW - pkW, ZYL, YYL, sinA, cosA);

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, pkH, pkH - data.GMT, false);

            // 顶右
            path = MoldUtils.getCornerPath(W - qkW, W, W, ZYL, YYL, sinA, cosA);

            count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, null, 2, 0, -data.GMT, false);

            // 斜封
            count = MoldUtils.getXieFenVI2(count, vertices, indices, facevec, cosA, sinA, ZYL, YYL, W, qkW, pkW, pkH, data.GMT, W - qkW - pkW, W - qkW);

        }

        // 左封
        path = [
            new Vector2(0, pkH),
            new Vector2(0, -data.BKH),
            new Vector2(W, -data.BKH),
            new Vector2(W, 0),
            new Vector2(W - qkW, 0),
            new Vector2(W - qkW - pkW, pkH)
        ];
        backface = [
            new Vector3(ZYL * cosA, pkH, ZYL * sinA),
            new Vector3(ZYL * cosA, -data.BKH, ZYL * sinA),
            new Vector3(ZYL * cosA + W * sinA, -data.BKH, ZYL * sinA - W * cosA),
            new Vector3(ZYL * cosA + W * sinA, 0, ZYL * sinA - W * cosA),
            new Vector3(ZYL * cosA + (W - qkW) * sinA, 0, ZYL * sinA - (W - qkW) * cosA),
            new Vector3(ZYL * cosA + (W - qkW - pkW) * sinA, pkH, ZYL * sinA - (W - qkW - pkW) * cosA)
        ]

        frontface = [
            new Vector3((ZYL - data.zyybkT) * cosA, pkH, (ZYL - data.zyybkT) * sinA),
            new Vector3((ZYL - data.zyybkT) * cosA, -data.BKH, (ZYL - data.zyybkT) * sinA),
            new Vector3((ZYL - data.zyybkT) * cosA + W * sinA, -data.BKH, (ZYL - data.zyybkT) * sinA - W * cosA),
            new Vector3((ZYL - data.zyybkT) * cosA + W * sinA, 0, (ZYL - data.zyybkT) * sinA - W * cosA),
            new Vector3((ZYL - data.zyybkT) * cosA + (W - qkW) * sinA, 0, (ZYL - data.zyybkT) * sinA - (W - qkW) * cosA),
            new Vector3((ZYL - data.zyybkT) * cosA + (W - qkW - pkW) * sinA, pkH, (ZYL - data.zyybkT) * sinA - (W - qkW - pkW) * cosA)
        ]
        let zfkw = AModelFmulaUtils.getHolesbyExpress(data.p_zfenkw, W, 2, data, AK.p_zfenkw);
        holes = [];

        for (i = 0; i < zfkw.length; i++) {
            xv = zfkw[i];
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > W - data.BKDia / 2 || xv < data.BKDia / 2) {
                continue;
            }

            holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);


        }


        count = MoldUtils.getFengVI(count, vertices, indices, facevec, ZYL, data.zyybkT, cosA, sinA, backface, frontface, path, holes);
        // 右封
        path = [
            new Vector2(pkH, 0),
            new Vector2(-data.BKH, 0),
            new Vector2(-data.BKH, W),
            new Vector2(0, W),
            new Vector2(0, W - qkW),
            new Vector2(pkH, W - qkW - pkW)
        ]
        let yfkw = AModelFmulaUtils.getHolesbyExpress(data.p_yfenkw, W, 2, data, AK.p_yfenkw);
        holes = [];

        for (let i = 0; i < yfkw.length; i++) {
            let xv = -(data.BKH - data.BKKJMDis);
            let yv = yfkw[i];

            if (yv > W - data.BKDia / 2 || yv < data.BKDia / 2) {
                continue;
            }

            let holePath = new Path();
            holePath.moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);


        }

        count = MoldUtils.getShapeVI(count, vertices, indices, facevec, path, holes, 1, YYL - data.zyybkT, YYL, false);

        // 左翼内竖孔
        fontp = MoldUtils.getLeftXieVi(W - data.zyybkT, W - data.zyybkT, ZYL, sinA, cosA);
        backp = MoldUtils.getLeftXieVi(W, W, ZYL, sinA, cosA);

        backpath = [
            new Vector2(0, 0),
            new Vector2(fontp[2], 0),
            new Vector2(fontp[2], -data.BKH),
            new Vector2(0, -data.BKH)
        ]
        backface = MoldUtils.getLeftXieFaceVI(W - data.zyybkT, W - data.zyybkT, ZYL, -data.BKH, 0, sinA, cosA);

        fontpath = [
            new Vector2(0, 0),
            new Vector2(backp[2], 0),
            new Vector2(backp[2], -data.BKH),
            new Vector2(0, -data.BKH)
        ]
        frontface = MoldUtils.getLeftXieFaceVI(W, W, ZYL, -data.BKH, 0, sinA, cosA);

        bholes = [];

        let zynsk = AModelFmulaUtils.getHolesbyExpress(data.p_zynsk, ZYL, 2, data, AK.p_zynsk);
        for (i = 0; i < zynsk.length; i++) {
            xv = zynsk[i];
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > ZYL - data.BKDia / 2 - (ZYL - backp[2])) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            bholes.push(holePath);
        }
        fholes = [];

        for (i = 0; i < zynsk.length; i++) {
            xv = zynsk[i] + (fontp[2] - backp[2]);
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > ZYL - data.BKDia / 2 - (ZYL - fontp[2])) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            fholes.push(holePath);


        }
        count = MoldUtils.getLeftHoleVI(count, vertices, indices, facevec, fholes, bholes, backpath, fontpath, backface, frontface, W, W, data.zyybkT, sinA, cosA);

        // type === 1 ? vertex.push(a * cosA + ZYW / sinA + YYW / sinA * cosA, b, a * sinA + YYW) :
        // type === 2 ? vertex.push(a * cosA + ZYW / sinA + YYW / sinA * cosA, b, a * sinA + YYW) :
        //     vertex.push(a, b, zv);



        // 右翼内竖孔

        let bx = (W - data.zyybkT) / sinA + (W - data.zyybkT) / sinA * cosA;
        let tx = W / sinA + W / sinA * cosA;

        holes = [];

        let yynsk = AModelFmulaUtils.getHolesbyExpress(data.p_yynsk, YYL - tx, 2, data, AK.p_yynsk);
        for (i = 0; i < yynsk.length; i++) {
            xv = yynsk[i] + tx;
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > YYL - data.BKDia / 2 || xv < tx + data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);

        }

        count = MoldUtils.getRightHoleVI(count, vertices, indices, facevec, holes, bx, tx, YYL, YYL, -data.BKH, 0, W - data.zyybkT, W, cosA, sinA, W, W);


        // 左翼外竖孔
        fontp = MoldUtils.getLeftXieVi(0, 0, ZYL, sinA, cosA);
        backp = MoldUtils.getLeftXieVi(data.zyybkT, data.zyybkT, ZYL, sinA, cosA);

        backpath = [
            new Vector2(0, pkH),
            new Vector2(fontp[2], pkH),
            new Vector2(fontp[2], -data.BKH),
            new Vector2(0, -data.BKH)
        ]
        backface = MoldUtils.getLeftXieFaceVI(0, 0, ZYL, -data.BKH, pkH, sinA, cosA);

        fontpath = [
            new Vector2(0, pkH),
            new Vector2(backp[2], pkH),
            new Vector2(backp[2], -data.BKH),
            new Vector2(0, -data.BKH)
        ]
        frontface = MoldUtils.getLeftXieFaceVI(data.zyybkT, data.zyybkT, ZYL, -data.BKH, pkH, sinA, cosA);

        bholes = [];

        let zywsk = AModelFmulaUtils.getHolesbyExpress(data.p_zywsk, ZYL, 2, data, AK.p_zywsk);
        for (i = 0; i < zywsk.length; i++) {
            xv = zywsk[i] - (ZYL - backp[2]);
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > ZYL - data.BKDia / 2 - (ZYL - backp[2])) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            bholes.push(holePath);
        }
        fholes = [];

        for (i = 0; i < zywsk.length; i++) {
            xv = zywsk[i] - (ZYL - fontp[2]);
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > ZYL - data.BKDia / 2 - (ZYL - fontp[2])) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            fholes.push(holePath);


        }
        count = MoldUtils.getLeftHoleVI(count, vertices, indices, facevec, fholes, bholes, backpath, fontpath, backface, frontface, data.zyybkT, data.zyybkT, data.zyybkT, sinA, cosA);


        // 右翼外竖孔
        bx = (0) / sinA + (0) / sinA * cosA;
        tx = data.zyybkT / sinA + data.zyybkT / sinA * cosA;

        holes = [];

        let yywsk = AModelFmulaUtils.getHolesbyExpress(data.p_yywsk, YYL, 2, data, AK.p_yywsk);
        for (i = 0; i < yywsk.length; i++) {
            xv = yywsk[i] + tx;
            yv = -(data.BKH - data.BKKJMDis);

            if (xv > YYL - data.BKDia / 2 - tx || xv < tx + data.BKDia / 2) {
                continue;
            }

            holePath = new Path()
                .moveTo(xv, yv)
                .absarc(xv, yv, data.BKDia / 2, 0, Math.PI * 2, true);

            holes.push(holePath);


        }


        count = MoldUtils.getRightHoleVI(count, vertices, indices, facevec, holes, bx, tx, YYL, YYL, -data.BKH, pkH, 0, data.zyybkT, cosA, sinA, W, W);

        // 支撑
        data.zcdata = [];
        if (data.p_zcsl === 1) {

            let centerpath = MoldUtils.getCornerPath(0, W, W, ZYL, YYL, sinA, cosA);

            let cenv = centerpath[0].add(centerpath[3]).multiplyScalar(0.5);

            count = MoldUtils.getCylinderVI(count, vertices, indices, facevec, cenv.x, cenv.y, data.ZCGdia, -data.zcgL, pkH);
            data.zcdata.push(cenv.x, pkH - data.GMT, cenv.y);
            data.zcdata.push(cenv.x, -data.zcgL, cenv.y);
        }

        return [vertices, indices, facevec];
    }

    /** 铝传料箱
    * @param data 
    * @returns 
    */
    static getLCLXVI(data: ALParams) {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];

        // 计数
        let count: number = 0;

        // 形状
        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        // 坐标
        let i: number, xv: number, yv: number;

        let W: number = Number(data.W);
        let L: number = Number(data.L);
        let H: number = Number(data.H);
        let KH: number = 8;

        data.gmpoint = [
            0, 0, 0,
            W, 0, 0,
            W, 0, L,
            0, 0, L
        ];

        data.duan = [
            0, 0, 0,
            W, 0, 0,
            W, 0, L,
            0, 0, L,
        ]

        data.zhong = {
            L: [
                {
                    pointer: [W / 2, 0, L],
                    center: [W / 2, 0, L / 2],

                }
            ],
            W: [
                {
                    pointer: [W, 0, L / 2],
                    center: [W / 2, 0, L / 2],

                }
            ],
            RL: [
                {
                    pointer: [W / 2, 0, 0],
                    center: [W / 2, 0, L / 2],

                }
            ],
            RW: [
                {
                    pointer: [0, 0, L / 2],
                    center: [W / 2, 0, L / 2],

                }
            ]
        }

        // 左框
        path = [
            new Vector2(0, 0),
            new Vector2(H, 0),
            new Vector2(H, L),
            new Vector2(0, L)
        ]
        holes = []
        let tmpface = [];

        count = this.getShapeVI(count, vertices, indices, facevec, path, holes, 1, 0, KH, true, AK.p_zkkw);

        // 右框
        path = [
            new Vector2(0, 0),
            new Vector2(H, 0),
            new Vector2(H, L),
            new Vector2(0, L)
        ]
        holes = []

        count = this.getShapeVI(count, vertices, indices, facevec, path, holes, 1, W - KH, W, true, AK.p_ykkw);

        // 上框
        path = [
            new Vector2(0, 0),
            new Vector2(0, H),
            new Vector2(W, H),
            new Vector2(W, 0)
        ]
        holes = []

        count = this.getShapeVI(count, vertices, indices, facevec, path, holes, 0, L - KH, L, true, AK.p_skkw);

        // 下框
        path = [
            new Vector2(0, 0),
            new Vector2(0, H),
            new Vector2(W, H),
            new Vector2(W, 0)
        ]
        holes = []

        count = this.getShapeVI(count, vertices, indices, facevec, path, holes, 0, 0, KH, true, AK.p_xkkw);
        return [vertices, indices, facevec];
    }

    /**铝盒子
    * @param data 
    * @returns 
    */
    static getLHZVI(data: ALParams) {
        // 数据
        let vertices: any[] = [];
        let indices: any[] = [];
        let facevec: any[] = [];

        // 计数
        let count: number = 0;

        // 形状
        let path: Vector2[];
        let holes: Path[];
        let holePath: Path;

        // 坐标
        let i: number, xv: number, yv: number;

        let W: number = Number(data.W);
        let L: number = Number(data.L);
        let H: number = Number(data.H);

        data.gmpoint = [
            0, 0, 0,
            W, 0, 0,
            W, 0, L,
            0, 0, L
        ];

        data.duan = [
            0, 0, 0,
            W, 0, 0,
            W, 0, L,
            0, 0, L,
        ]

        data.zhong = {
            L: [
                {
                    pointer: [W / 2, 0, L],
                    center: [W / 2, 0, L / 2],

                }
            ],
            W: [
                {
                    pointer: [W, 0, L / 2],
                    center: [W / 2, 0, L / 2],

                }
            ],
            RL: [
                {
                    pointer: [W / 2, 0, 0],
                    center: [W / 2, 0, L / 2],

                }
            ],
            RW: [
                {
                    pointer: [0, 0, L / 2],
                    center: [W / 2, 0, L / 2],

                }
            ]
        }


        // 边框孔中心点
        data.kongpoint = [];
        let kongpoint = [];

        // 光面
        let gmpath: Vector2[] = [
            new Vector2(0, 0),
            new Vector2(0, L),
            new Vector2(W, L),
            new Vector2(W, 0)
        ];

        holes = [];
        let tmpface = [];
        for (i = 0; i < gmpath.length; i++) {
            tmpface.push(new Vector3(gmpath[i].x, 0, gmpath[i].y));
        }

        count = this.getFaceByFunction(count, vertices, indices, facevec, tmpface, gmpath, holes, AK.p_r1dw,
            (a: number, b: number) => [a, 0, b]);
        tmpface = [];
        for (i = 0; i < gmpath.length; i++) {
            tmpface.push(new Vector3(gmpath[i].x, H, gmpath[i].y));
        }
        count = this.getFaceByFunction(count, vertices, indices, facevec, tmpface, gmpath, holes, AK.p_r1dw,
            (a: number, b: number) => [a, H, b]);

        // 左框
        path = [
            new Vector2(0, 0),
            new Vector2(H, 0),
            new Vector2(H, L),
            new Vector2(0, L)
        ]
        holes = []
        tmpface = [];
        for (i = 0; i < path.length; i++) {
            tmpface.push(new Vector3(0, path[i].x, path[i].y));
        }

        count = this.getFaceByFunction(count, vertices, indices, facevec, tmpface, path, holes, AK.p_zkkw,
            (a: number, b: number) => [0, a, b]);

        // 右框
        path = [
            new Vector2(0, 0),
            new Vector2(H, 0),
            new Vector2(H, L),
            new Vector2(0, L)
        ]
        tmpface = [];
        for (i = 0; i < path.length; i++) {
            tmpface.push(new Vector3(W, path[i].x, path[i].y));
        }

        count = this.getFaceByFunction(count, vertices, indices, facevec, tmpface, path, holes, AK.p_ykkw,
            (a: number, b: number) => [W, a, b]);

        // 上框
        path = [
            new Vector2(0, 0),
            new Vector2(0, H),
            new Vector2(W, H),
            new Vector2(W, 0)
        ]
        tmpface = [];
        for (i = 0; i < path.length; i++) {
            tmpface.push(new Vector3(path[i].x, path[i].y, L));
        }

        count = this.getFaceByFunction(count, vertices, indices, facevec, tmpface, path, holes, AK.p_skkw,
            (a: number, b: number) => [a, b, L]);

        // 下框
        path = [
            new Vector2(0, 0),
            new Vector2(0, H),
            new Vector2(W, H),
            new Vector2(W, 0)
        ]
        tmpface = [];
        for (i = 0; i < path.length; i++) {
            tmpface.push(new Vector3(path[i].x, path[i].y, 0));
        }

        count = this.getFaceByFunction(count, vertices, indices, facevec, tmpface, path, holes, AK.p_xkkw,
            (a: number, b: number) => [a, b, 0]);

        return [vertices, indices, facevec];
    }

    static getFaceByFunction(count: number, vertices: number[], indices: number[], facevec: Vector3[][],
        face: Vector3[], path: Vector2[], holePath: Path[], kongtype: string, fuc: Function): number {

        if (!path || path.length == 0) {
            console.log("模型路径有问题")
            return count;
        }

        let shape = new Shape().setFromPoints(path);
        // 挖孔

        if (holePath && holePath.length > 0) {
            let tmpholes = this.getHoleByDivisions(holePath);
            shape.holes.push(...tmpholes);
        }

        let geometry = this.getShapeData(shape);
        count = this.getFaceByGeometry(count, vertices, indices, facevec, face, geometry, kongtype, fuc);
        shape = null;
        // geometry.dispose();

        return count;
    }
  
    static getShapeData(shape: Shape, curveSegments = 12) {

        const indices = [];
        const vertices = [];
        // const normals = [];
        // const uvs = [];

        const indexOffset = vertices.length / 3;
        const points = shape.extractPoints(curveSegments);

        let shapeVertices = points.shape;
        const shapeHoles = points.holes;

        // check direction of vertices

        if (ShapeUtils.isClockWise(shapeVertices) === false) {

            shapeVertices = shapeVertices.reverse();

        }

        for (let i = 0, l = shapeHoles.length; i < l; i++) {

            const shapeHole = shapeHoles[i];

            if (ShapeUtils.isClockWise(shapeHole) === true) {
                shapeHoles[i] = shapeHole.reverse();
            }

        }

        const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles);

        // join vertices of inner and outer paths to a single array

        for (let i = 0, l = shapeHoles.length; i < l; i++) {

            const shapeHole = shapeHoles[i];
            shapeVertices = shapeVertices.concat(shapeHole);

        }

        // vertices, normals, uvs

        for (let i = 0, l = shapeVertices.length; i < l; i++) {

            const vertex = shapeVertices[i];
            vertices.push(vertex.x, vertex.y, 0);
            // normals.push(0, 0, 1);
            // uvs.push(vertex.x, vertex.y); // world uvs
        }

        // indices
        for (let i = 0, l = faces.length; i < l; i++) {

            const face = faces[i];

            const a = face[0] + indexOffset;
            const b = face[1] + indexOffset;
            const c = face[2] + indexOffset;

            indices.push(a, b, c);

        }

        return [vertices, indices];
    }
    static getFaceByGeometry(count: number, vertices: number[], indices: number[], facevec: any[],
        face: Vector3[], geometry: any, kongtype: string, fuc: Function): number {

        let position = geometry[0];
        let index = geometry[1];

        let vertex: any[] = []
        let idxAry: any[] = [];

        for (let i = 0; i < position.length; i += 3) {

            let a = position[i];
            let b = position[i + 1];
            let c = position[i + 2];
            let xyz = fuc(a, b);
            vertex.push(xyz[0], xyz[1], xyz[2]);
        }

        // 索引
        for (let i = 0; i < index.length; i += 3) {
            let a = index[i] + count;
            let b = index[i + 1] + count;
            let c = index[i + 2] + count;

            idxAry.push(a, b, c);
        }

        vertices.push(...vertex);
        indices.push(...idxAry);
        kongtype ? facevec.push({ key: kongtype, faces: [...face] }) : facevec.push(face);

        count = Math.max(...indices) + 1;

        return count;
    }
}